[clang] [Clang] [NFC] Introduce `DynamicRecursiveASTVisitor` (PR #105195)

via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 20 11:13:29 PDT 2024


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 27e5f505e5eee3da27c1515d6ed95d66fbe543ea 8f7d61923b414085d5d1e419cebd46500cef2662 --extensions cpp,h -- clang/include/clang/AST/DynamicRecursiveASTVisitor.h clang/lib/AST/DynamicRecursiveASTVisitor.cpp clang/unittests/Tooling/CRTPTestVisitor.h clang/examples/CallSuperAttribute/CallSuperAttrInfo.cpp clang/examples/PrintFunctionNames/PrintFunctionNames.cpp clang/include/clang/AST/RecursiveASTVisitor.h clang/include/clang/Analysis/CallGraph.h clang/include/clang/Analysis/FlowSensitive/ASTOps.h clang/include/clang/InstallAPI/Visitor.h clang/include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h clang/lib/ARCMigrate/ObjCMT.cpp clang/lib/ARCMigrate/TransAPIUses.cpp clang/lib/ARCMigrate/TransARCAssign.cpp clang/lib/ARCMigrate/TransAutoreleasePool.cpp clang/lib/ARCMigrate/TransBlockObjCVariable.cpp clang/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp clang/lib/ARCMigrate/TransGCAttrs.cpp clang/lib/ARCMigrate/TransGCCalls.cpp clang/lib/ARCMigrate/TransProtectedScope.cpp clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp clang/lib/ARCMigrate/Transforms.cpp clang/lib/ARCMigrate/Transforms.h clang/lib/AST/ASTImporterLookupTable.cpp clang/lib/AST/ParentMapContext.cpp clang/lib/AST/StmtOpenACC.cpp clang/lib/ASTMatchers/ASTMatchFinder.cpp clang/lib/ASTMatchers/GtestMatchers.cpp clang/lib/Analysis/CallGraph.cpp clang/lib/Analysis/CalledOnceCheck.cpp clang/lib/Analysis/FlowSensitive/ASTOps.cpp clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp clang/lib/Analysis/ReachableCode.cpp clang/lib/Analysis/UnsafeBufferUsage.cpp clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/CodeGenPGO.cpp clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp clang/lib/Frontend/ASTConsumers.cpp clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp clang/lib/Index/IndexBody.cpp clang/lib/Index/IndexTypeSourceInfo.cpp clang/lib/InstallAPI/Visitor.cpp clang/lib/Sema/AnalysisBasedWarnings.cpp clang/lib/Sema/SemaAvailability.cpp clang/lib/Sema/SemaCodeComplete.cpp clang/lib/Sema/SemaConcept.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaDeclCXX.cpp clang/lib/Sema/SemaDeclObjC.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaExprCXX.cpp clang/lib/Sema/SemaHLSL.cpp clang/lib/Sema/SemaStmt.cpp clang/lib/Sema/SemaTemplate.cpp clang/lib/Sema/SemaTemplateDeduction.cpp clang/lib/Sema/SemaTemplateDeductionGuide.cpp clang/lib/Sema/SemaTemplateVariadic.cpp clang/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp clang/lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/NoUncountedMembersChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp clang/lib/StaticAnalyzer/Core/BugSuppression.cpp clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp clang/lib/Tooling/ASTDiff/ASTDiff.cpp clang/lib/Tooling/Refactoring/Rename/USRFinder.cpp clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp clang/unittests/AST/EvaluateAsRValueTest.cpp clang/unittests/Analysis/CloneDetectionTest.cpp clang/unittests/Frontend/FrontendActionTest.cpp clang/unittests/Tooling/ASTSelectionTest.cpp clang/unittests/Tooling/CastExprTest.cpp clang/unittests/Tooling/CommentHandlerTest.cpp clang/unittests/Tooling/ExecutionTest.cpp clang/unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp clang/unittests/Tooling/LookupTest.cpp clang/unittests/Tooling/QualTypeNamesTest.cpp clang/unittests/Tooling/RecursiveASTVisitorTestDeclVisitor.cpp clang/unittests/Tooling/RecursiveASTVisitorTestPostOrderVisitor.cpp clang/unittests/Tooling/RecursiveASTVisitorTestTypeLocVisitor.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/Attr.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/BitfieldInitializer.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/CXXBoolLiteralExpr.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/CXXMemberCall.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/CXXMethodDecl.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/CXXOperatorCallExprTraverser.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/CallbacksCommon.h clang/unittests/Tooling/RecursiveASTVisitorTests/Class.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/Concept.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/ConstructExpr.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/DeclRefExpr.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/DeductionGuide.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/ImplicitCtor.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/ImplicitCtorInitializer.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/InitListExprPostOrder.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/InitListExprPostOrderNoQueue.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/InitListExprPreOrder.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/InitListExprPreOrderNoQueue.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/IntegerLiteral.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaDefaultCapture.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaExpr.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaTemplateParams.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/MemberPointerTypeLoc.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/NestedNameSpecifiers.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/ParenExpr.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/TemplateArgumentLocTraverser.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/TraversalScope.cpp clang/unittests/Tooling/RefactoringTest.cpp clang/unittests/Tooling/SourceCodeTest.cpp clang/unittests/Tooling/TestVisitor.h clang/utils/TableGen/ClangAttrEmitter.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp b/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp
index 248e3e159b..9f95bbd847 100644
--- a/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp
+++ b/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp
@@ -11,11 +11,11 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/Frontend/FrontendPluginRegistry.h"
 #include "clang/AST/AST.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/FrontendPluginRegistry.h"
 #include "clang/Sema/Sema.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace clang;
diff --git a/clang/include/clang/Analysis/FlowSensitive/ASTOps.h b/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
index 7a9ea1c25e..6294c81062 100644
--- a/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
+++ b/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
@@ -14,9 +14,9 @@
 #define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_ASTOPS_H
 
 #include "clang/AST/Decl.h"
+#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
-#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/Type.h"
 #include "clang/Analysis/FlowSensitive/StorageLocation.h"
 #include "llvm/ADT/DenseSet.h"
diff --git a/clang/include/clang/InstallAPI/Visitor.h b/clang/include/clang/InstallAPI/Visitor.h
index ab8b5588b6..a04100b7b1 100644
--- a/clang/include/clang/InstallAPI/Visitor.h
+++ b/clang/include/clang/InstallAPI/Visitor.h
@@ -13,8 +13,8 @@
 #ifndef LLVM_CLANG_INSTALLAPI_VISITOR_H
 #define LLVM_CLANG_INSTALLAPI_VISITOR_H
 
-#include "clang/AST/Mangle.h"
 #include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/AST/Mangle.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/InstallAPI/Context.h"
diff --git a/clang/include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h b/clang/include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h
index aeea0c1b2d..09c58ee02f 100644
--- a/clang/include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h
+++ b/clang/include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h
@@ -30,7 +30,7 @@ public:
       : SM(SM), LangOpts(LangOpts) {}
 
   virtual bool visitSymbolOccurrence(const NamedDecl *ND,
-                             ArrayRef<SourceRange> NameRanges) {
+                                     ArrayRef<SourceRange> NameRanges) {
     return true;
   }
 
diff --git a/clang/lib/AST/DynamicRecursiveASTVisitor.cpp b/clang/lib/AST/DynamicRecursiveASTVisitor.cpp
index 133e276206..b5dc791541 100644
--- a/clang/lib/AST/DynamicRecursiveASTVisitor.cpp
+++ b/clang/lib/AST/DynamicRecursiveASTVisitor.cpp
@@ -41,9 +41,7 @@ struct Impl : RecursiveASTVisitor<Impl> {
   bool TraverseDecl(Decl *D) { return Visitor.TraverseDecl(D); }
   bool TraverseType(QualType T) { return Visitor.TraverseType(T); }
   bool TraverseTypeLoc(TypeLoc TL) { return Visitor.TraverseTypeLoc(TL); }
-  bool TraverseStmt(Stmt *S) {
-    return Visitor.TraverseStmt(S);
-  }
+  bool TraverseStmt(Stmt *S) { return Visitor.TraverseStmt(S); }
 
   bool TraverseConstructorInitializer(CXXCtorInitializer *Init) {
     return Visitor.TraverseConstructorInitializer(Init);
@@ -115,7 +113,7 @@ struct Impl : RecursiveASTVisitor<Impl> {
 
   // TraverseStmt() always passes in a queue, so we have no choice but to
   // accept it as a parameter here.
-  bool dataTraverseNode(Stmt *S, DataRecursionQueue* = nullptr) {
+  bool dataTraverseNode(Stmt *S, DataRecursionQueue * = nullptr) {
     // But since don't support postorder traversal, we don't need it, so
     // simply discard it here. This way, derived classes don't need to worry
     // about including it as a parameter that they never use.
@@ -196,7 +194,7 @@ struct Impl : RecursiveASTVisitor<Impl> {
 };
 } // namespace
 
-void DynamicRecursiveASTVisitor::anchor() { }
+void DynamicRecursiveASTVisitor::anchor() {}
 
 bool DynamicRecursiveASTVisitor::TraverseAST(ASTContext &AST) {
   return Impl(*this).RecursiveASTVisitor<Impl>::TraverseAST(AST);
@@ -259,8 +257,10 @@ bool DynamicRecursiveASTVisitor::TraverseTypeConstraint(
     const TypeConstraint *C) {
   return Impl(*this).RecursiveASTVisitor<Impl>::TraverseTypeConstraint(C);
 }
-bool DynamicRecursiveASTVisitor::TraverseObjCProtocolLoc(ObjCProtocolLoc ProtocolLoc) {
-  return Impl(*this).RecursiveASTVisitor<Impl>::TraverseObjCProtocolLoc(ProtocolLoc);
+bool DynamicRecursiveASTVisitor::TraverseObjCProtocolLoc(
+    ObjCProtocolLoc ProtocolLoc) {
+  return Impl(*this).RecursiveASTVisitor<Impl>::TraverseObjCProtocolLoc(
+      ProtocolLoc);
 }
 
 bool DynamicRecursiveASTVisitor::TraverseConceptRequirement(
@@ -288,7 +288,6 @@ bool DynamicRecursiveASTVisitor::TraverseConceptReference(
   return Impl(*this).RecursiveASTVisitor<Impl>::TraverseConceptReference(CR);
 }
 
-
 bool DynamicRecursiveASTVisitor::TraverseCXXBaseSpecifier(
     const CXXBaseSpecifier &Base) {
   return Impl(*this).RecursiveASTVisitor<Impl>::TraverseCXXBaseSpecifier(Base);
diff --git a/clang/lib/AST/ParentMapContext.cpp b/clang/lib/AST/ParentMapContext.cpp
index eb8a2119af..a5420f2875 100644
--- a/clang/lib/AST/ParentMapContext.cpp
+++ b/clang/lib/AST/ParentMapContext.cpp
@@ -12,8 +12,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/AST/ParentMapContext.h"
-#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/Decl.h"
+#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/TemplateBase.h"
@@ -425,30 +425,41 @@ private:
 
   bool TraverseDecl(Decl *DeclNode) override {
     return TraverseNode(
-        DeclNode, DeclNode, [&] { return DynamicRecursiveASTVisitor::TraverseDecl(DeclNode); },
+        DeclNode, DeclNode,
+        [&] { return DynamicRecursiveASTVisitor::TraverseDecl(DeclNode); },
         &Map.PointerParents);
   }
   bool TraverseTypeLoc(TypeLoc TypeLocNode) override {
     return TraverseNode(
         TypeLocNode, DynTypedNode::create(TypeLocNode),
-        [&] { return DynamicRecursiveASTVisitor::TraverseTypeLoc(TypeLocNode); },
+        [&] {
+          return DynamicRecursiveASTVisitor::TraverseTypeLoc(TypeLocNode);
+        },
         &Map.OtherParents);
   }
-  bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNSLocNode) override {
+  bool
+  TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNSLocNode) override {
     return TraverseNode(
         NNSLocNode, DynTypedNode::create(NNSLocNode),
-        [&] { return DynamicRecursiveASTVisitor::TraverseNestedNameSpecifierLoc(NNSLocNode); },
+        [&] {
+          return DynamicRecursiveASTVisitor::TraverseNestedNameSpecifierLoc(
+              NNSLocNode);
+        },
         &Map.OtherParents);
   }
   bool TraverseAttr(Attr *AttrNode) override {
     return TraverseNode(
-        AttrNode, AttrNode, [&] { return DynamicRecursiveASTVisitor::TraverseAttr(AttrNode); },
+        AttrNode, AttrNode,
+        [&] { return DynamicRecursiveASTVisitor::TraverseAttr(AttrNode); },
         &Map.PointerParents);
   }
   bool TraverseObjCProtocolLoc(ObjCProtocolLoc ProtocolLocNode) override {
     return TraverseNode(
         ProtocolLocNode, DynTypedNode::create(ProtocolLocNode),
-        [&] { return DynamicRecursiveASTVisitor::TraverseObjCProtocolLoc(ProtocolLocNode); },
+        [&] {
+          return DynamicRecursiveASTVisitor::TraverseObjCProtocolLoc(
+              ProtocolLocNode);
+        },
         &Map.OtherParents);
   }
 
diff --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp b/clang/lib/ASTMatchers/ASTMatchFinder.cpp
index e0aecb1d1c..1840bf021e 100644
--- a/clang/lib/ASTMatchers/ASTMatchFinder.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchFinder.cpp
@@ -232,7 +232,7 @@ public:
     ScopedIncrement ScopedDepth(&CurrentDepth);
     return traverse(*CtorInit);
   }
-  bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc& TAL) override {
+  bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc &TAL) override {
     ScopedIncrement ScopedDepth(&CurrentDepth);
     return traverse(TAL);
   }
@@ -254,9 +254,11 @@ public:
       return false;
     return DynamicRecursiveASTVisitor::TraverseStmt(Node->getBody());
   }
-  bool TraverseCXXRewrittenBinaryOperator(CXXRewrittenBinaryOperator *Node) override {
+  bool TraverseCXXRewrittenBinaryOperator(
+      CXXRewrittenBinaryOperator *Node) override {
     if (!Finder->isTraversalIgnoringImplicitNodes())
-      return DynamicRecursiveASTVisitor::TraverseCXXRewrittenBinaryOperator(Node);
+      return DynamicRecursiveASTVisitor::TraverseCXXRewrittenBinaryOperator(
+          Node);
     if (!Node)
       return true;
     ScopedIncrement ScopedDepth(&CurrentDepth);
@@ -326,10 +328,12 @@ private:
   // Forwards the call to the corresponding Traverse*() method in the
   // base visitor class.
   bool baseTraverse(const Decl &DeclNode) {
-    return DynamicRecursiveASTVisitor::TraverseDecl(const_cast<Decl*>(&DeclNode));
+    return DynamicRecursiveASTVisitor::TraverseDecl(
+        const_cast<Decl *>(&DeclNode));
   }
   bool baseTraverse(const Stmt &StmtNode) {
-    return DynamicRecursiveASTVisitor::TraverseStmt(const_cast<Stmt*>(&StmtNode));
+    return DynamicRecursiveASTVisitor::TraverseStmt(
+        const_cast<Stmt *>(&StmtNode));
   }
   bool baseTraverse(QualType TypeNode) {
     return DynamicRecursiveASTVisitor::TraverseType(TypeNode);
@@ -339,7 +343,7 @@ private:
   }
   bool baseTraverse(const NestedNameSpecifier &NNS) {
     return DynamicRecursiveASTVisitor::TraverseNestedNameSpecifier(
-        const_cast<NestedNameSpecifier*>(&NNS));
+        const_cast<NestedNameSpecifier *>(&NNS));
   }
   bool baseTraverse(NestedNameSpecifierLoc NNS) {
     return DynamicRecursiveASTVisitor::TraverseNestedNameSpecifierLoc(NNS);
@@ -352,7 +356,8 @@ private:
     return DynamicRecursiveASTVisitor::TraverseTemplateArgumentLoc(TAL);
   }
   bool baseTraverse(const Attr &AttrNode) {
-    return DynamicRecursiveASTVisitor::TraverseAttr(const_cast<Attr *>(&AttrNode));
+    return DynamicRecursiveASTVisitor::TraverseAttr(
+        const_cast<Attr *>(&AttrNode));
   }
 
   // Sets 'Matched' to true if 'Matcher' matches 'Node' and:
@@ -500,7 +505,7 @@ public:
   bool TraverseNestedNameSpecifier(NestedNameSpecifier *NNS) override;
   bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS) override;
   bool TraverseConstructorInitializer(CXXCtorInitializer *CtorInit) override;
-  bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc& TAL) override;
+  bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc &TAL) override;
   bool TraverseAttr(Attr *AttrNode) override;
 
   bool dataTraverseNode(Stmt *S) override {
@@ -744,20 +749,17 @@ public:
 
   bool TraverseTemplateInstantiations(ClassTemplateDecl *D) override {
     ASTNodeNotSpelledInSourceScope RAII(this, true);
-    return DynamicRecursiveASTVisitor::TraverseTemplateInstantiations(
-        D);
+    return DynamicRecursiveASTVisitor::TraverseTemplateInstantiations(D);
   }
 
   bool TraverseTemplateInstantiations(VarTemplateDecl *D) override {
     ASTNodeNotSpelledInSourceScope RAII(this, true);
-    return DynamicRecursiveASTVisitor::TraverseTemplateInstantiations(
-        D);
+    return DynamicRecursiveASTVisitor::TraverseTemplateInstantiations(D);
   }
 
   bool TraverseTemplateInstantiations(FunctionTemplateDecl *D) override {
     ASTNodeNotSpelledInSourceScope RAII(this, true);
-    return DynamicRecursiveASTVisitor::TraverseTemplateInstantiations(
-        D);
+    return DynamicRecursiveASTVisitor::TraverseTemplateInstantiations(D);
   }
 
 private:
@@ -1503,8 +1505,7 @@ bool MatchASTVisitor::TraverseNestedNameSpecifierLoc(
   // because the traversal is already done in the parallel "Loc"-hierarchy.
   if (NNS.hasQualifier())
     match(*NNS.getNestedNameSpecifier());
-  return
-      DynamicRecursiveASTVisitor::TraverseNestedNameSpecifierLoc(NNS);
+  return DynamicRecursiveASTVisitor::TraverseNestedNameSpecifierLoc(NNS);
 }
 
 bool MatchASTVisitor::TraverseConstructorInitializer(
@@ -1522,11 +1523,11 @@ bool MatchASTVisitor::TraverseConstructorInitializer(
 
   match(*CtorInit);
 
-  return DynamicRecursiveASTVisitor::TraverseConstructorInitializer(
-      CtorInit);
+  return DynamicRecursiveASTVisitor::TraverseConstructorInitializer(CtorInit);
 }
 
-bool MatchASTVisitor::TraverseTemplateArgumentLoc(const TemplateArgumentLoc& Loc) {
+bool MatchASTVisitor::TraverseTemplateArgumentLoc(
+    const TemplateArgumentLoc &Loc) {
   match(Loc);
   return DynamicRecursiveASTVisitor::TraverseTemplateArgumentLoc(Loc);
 }
diff --git a/clang/lib/Analysis/CalledOnceCheck.cpp b/clang/lib/Analysis/CalledOnceCheck.cpp
index cada4add01..f97339bc93 100644
--- a/clang/lib/Analysis/CalledOnceCheck.cpp
+++ b/clang/lib/Analysis/CalledOnceCheck.cpp
@@ -11,11 +11,11 @@
 #include "clang/AST/Attr.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclBase.h"
+#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/OperationKinds.h"
 #include "clang/AST/ParentMap.h"
-#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/Stmt.h"
 #include "clang/AST/StmtObjC.h"
 #include "clang/AST/StmtVisitor.h"
diff --git a/clang/lib/Analysis/ReachableCode.cpp b/clang/lib/Analysis/ReachableCode.cpp
index 02948479fa..344047beaa 100644
--- a/clang/lib/Analysis/ReachableCode.cpp
+++ b/clang/lib/Analysis/ReachableCode.cpp
@@ -13,11 +13,11 @@
 
 #include "clang/Analysis/Analyses/ReachableCode.h"
 #include "clang/AST/Attr.h"
+#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/ParentMap.h"
-#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/StmtCXX.h"
 #include "clang/Analysis/AnalysisDeclContext.h"
 #include "clang/Analysis/CFG.h"
diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp
index 22b628d230..0fc99dc9fb 100644
--- a/clang/lib/Analysis/UnsafeBufferUsage.cpp
+++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp
@@ -9,8 +9,8 @@
 #include "clang/Analysis/Analyses/UnsafeBufferUsage.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
-#include "clang/AST/Expr.h"
 #include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/AST/Expr.h"
 #include "clang/AST/Stmt.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
@@ -135,7 +135,8 @@ public:
     return DynamicRecursiveASTVisitor::TraverseGenericSelectionExpr(Node);
   }
 
-  bool TraverseUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *Node) override {
+  bool
+  TraverseUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *Node) override {
     // Unevaluated context.
     if (ignoreUnevaluatedContext)
       return true;
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
index c3bc1641e5..848030dd30 100644
--- a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
+++ b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
@@ -11,8 +11,8 @@
 #include "CodeGenModule.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclObjC.h"
-#include "clang/AST/Expr.h"
 #include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/AST/Expr.h"
 #include "clang/Basic/CodeGenOptions.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/TargetInfo.h"
diff --git a/clang/lib/Frontend/ASTConsumers.cpp b/clang/lib/Frontend/ASTConsumers.cpp
index 5ecd17ad36..180075119d 100644
--- a/clang/lib/Frontend/ASTConsumers.cpp
+++ b/clang/lib/Frontend/ASTConsumers.cpp
@@ -14,9 +14,9 @@
 #include "clang/AST/AST.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/RecordLayout.h"
-#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/SourceManager.h"
 #include "llvm/Support/Path.h"
@@ -28,130 +28,129 @@ using namespace clang;
 /// ASTPrinter - Pretty-printer and dumper of ASTs
 
 namespace {
-  class ASTPrinter : public ASTConsumer,
-                     public DynamicRecursiveASTVisitor {
-  public:
-    enum Kind { DumpFull, Dump, Print, None };
-    ASTPrinter(std::unique_ptr<raw_ostream> Out, Kind K,
-               ASTDumpOutputFormat Format, StringRef FilterString,
-               bool DumpLookups = false, bool DumpDeclTypes = false)
-        : Out(Out ? *Out : llvm::outs()), OwnedOut(std::move(Out)),
-          OutputKind(K), OutputFormat(Format), FilterString(FilterString),
-          DumpLookups(DumpLookups), DumpDeclTypes(DumpDeclTypes) {
-      ShouldWalkTypesOfTypeLocs = false;
-    }
+class ASTPrinter : public ASTConsumer, public DynamicRecursiveASTVisitor {
+public:
+  enum Kind { DumpFull, Dump, Print, None };
+  ASTPrinter(std::unique_ptr<raw_ostream> Out, Kind K,
+             ASTDumpOutputFormat Format, StringRef FilterString,
+             bool DumpLookups = false, bool DumpDeclTypes = false)
+      : Out(Out ? *Out : llvm::outs()), OwnedOut(std::move(Out)), OutputKind(K),
+        OutputFormat(Format), FilterString(FilterString),
+        DumpLookups(DumpLookups), DumpDeclTypes(DumpDeclTypes) {
+    ShouldWalkTypesOfTypeLocs = false;
+  }
 
-    void HandleTranslationUnit(ASTContext &Context) override {
-      TranslationUnitDecl *D = Context.getTranslationUnitDecl();
+  void HandleTranslationUnit(ASTContext &Context) override {
+    TranslationUnitDecl *D = Context.getTranslationUnitDecl();
 
-      if (FilterString.empty())
-        return print(D);
+    if (FilterString.empty())
+      return print(D);
 
-      TraverseDecl(D);
-    }
+    TraverseDecl(D);
+  }
 
-    bool TraverseDecl(Decl *D) override {
-      if (D && filterMatches(D)) {
-        bool ShowColors = Out.has_colors();
-        if (ShowColors)
-          Out.changeColor(raw_ostream::BLUE);
-
-        if (OutputFormat == ADOF_Default)
-          Out << (OutputKind != Print ? "Dumping " : "Printing ") << getName(D)
-              << ":\n";
-
-        if (ShowColors)
-          Out.resetColor();
-        print(D);
-        Out << "\n";
-        // Don't traverse child nodes to avoid output duplication.
-        return true;
-      }
-      return DynamicRecursiveASTVisitor::TraverseDecl(D);
+  bool TraverseDecl(Decl *D) override {
+    if (D && filterMatches(D)) {
+      bool ShowColors = Out.has_colors();
+      if (ShowColors)
+        Out.changeColor(raw_ostream::BLUE);
+
+      if (OutputFormat == ADOF_Default)
+        Out << (OutputKind != Print ? "Dumping " : "Printing ") << getName(D)
+            << ":\n";
+
+      if (ShowColors)
+        Out.resetColor();
+      print(D);
+      Out << "\n";
+      // Don't traverse child nodes to avoid output duplication.
+      return true;
     }
+    return DynamicRecursiveASTVisitor::TraverseDecl(D);
+  }
 
-  private:
-    std::string getName(Decl *D) {
-      if (isa<NamedDecl>(D))
-        return cast<NamedDecl>(D)->getQualifiedNameAsString();
-      return "";
-    }
-    bool filterMatches(Decl *D) {
-      return getName(D).find(FilterString) != std::string::npos;
+private:
+  std::string getName(Decl *D) {
+    if (isa<NamedDecl>(D))
+      return cast<NamedDecl>(D)->getQualifiedNameAsString();
+    return "";
+  }
+  bool filterMatches(Decl *D) {
+    return getName(D).find(FilterString) != std::string::npos;
+  }
+  void print(Decl *D) {
+    if (DumpLookups) {
+      if (DeclContext *DC = dyn_cast<DeclContext>(D)) {
+        if (DC == DC->getPrimaryContext())
+          DC->dumpLookups(Out, OutputKind != None, OutputKind == DumpFull);
+        else
+          Out << "Lookup map is in primary DeclContext "
+              << DC->getPrimaryContext() << "\n";
+      } else
+        Out << "Not a DeclContext\n";
+    } else if (OutputKind == Print) {
+      PrintingPolicy Policy(D->getASTContext().getLangOpts());
+      D->print(Out, Policy, /*Indentation=*/0, /*PrintInstantiation=*/true);
+    } else if (OutputKind != None) {
+      D->dump(Out, OutputKind == DumpFull, OutputFormat);
     }
-    void print(Decl *D) {
-      if (DumpLookups) {
-        if (DeclContext *DC = dyn_cast<DeclContext>(D)) {
-          if (DC == DC->getPrimaryContext())
-            DC->dumpLookups(Out, OutputKind != None, OutputKind == DumpFull);
-          else
-            Out << "Lookup map is in primary DeclContext "
-                << DC->getPrimaryContext() << "\n";
-        } else
-          Out << "Not a DeclContext\n";
-      } else if (OutputKind == Print) {
-        PrintingPolicy Policy(D->getASTContext().getLangOpts());
-        D->print(Out, Policy, /*Indentation=*/0, /*PrintInstantiation=*/true);
-      } else if (OutputKind != None) {
-        D->dump(Out, OutputKind == DumpFull, OutputFormat);
-      }
-
-      if (DumpDeclTypes) {
-        Decl *InnerD = D;
-        if (auto *TD = dyn_cast<TemplateDecl>(D))
-          InnerD = TD->getTemplatedDecl();
-
-        // FIXME: Support OutputFormat in type dumping.
-        // FIXME: Support combining -ast-dump-decl-types with -ast-dump-lookups.
-        if (auto *VD = dyn_cast<ValueDecl>(InnerD))
-          VD->getType().dump(Out, VD->getASTContext());
-        if (auto *TD = dyn_cast<TypeDecl>(InnerD))
-          TD->getTypeForDecl()->dump(Out, TD->getASTContext());
-      }
+
+    if (DumpDeclTypes) {
+      Decl *InnerD = D;
+      if (auto *TD = dyn_cast<TemplateDecl>(D))
+        InnerD = TD->getTemplatedDecl();
+
+      // FIXME: Support OutputFormat in type dumping.
+      // FIXME: Support combining -ast-dump-decl-types with -ast-dump-lookups.
+      if (auto *VD = dyn_cast<ValueDecl>(InnerD))
+        VD->getType().dump(Out, VD->getASTContext());
+      if (auto *TD = dyn_cast<TypeDecl>(InnerD))
+        TD->getTypeForDecl()->dump(Out, TD->getASTContext());
     }
+  }
 
-    raw_ostream &Out;
-    std::unique_ptr<raw_ostream> OwnedOut;
+  raw_ostream &Out;
+  std::unique_ptr<raw_ostream> OwnedOut;
 
-    /// How to output individual declarations.
-    Kind OutputKind;
+  /// How to output individual declarations.
+  Kind OutputKind;
 
-    /// What format should the output take?
-    ASTDumpOutputFormat OutputFormat;
+  /// What format should the output take?
+  ASTDumpOutputFormat OutputFormat;
 
-    /// Which declarations or DeclContexts to display.
-    std::string FilterString;
+  /// Which declarations or DeclContexts to display.
+  std::string FilterString;
 
-    /// Whether the primary output is lookup results or declarations. Individual
-    /// results will be output with a format determined by OutputKind. This is
-    /// incompatible with OutputKind == Print.
-    bool DumpLookups;
+  /// Whether the primary output is lookup results or declarations. Individual
+  /// results will be output with a format determined by OutputKind. This is
+  /// incompatible with OutputKind == Print.
+  bool DumpLookups;
 
-    /// Whether to dump the type for each declaration dumped.
-    bool DumpDeclTypes;
-  };
+  /// Whether to dump the type for each declaration dumped.
+  bool DumpDeclTypes;
+};
 
-  class ASTDeclNodeLister : public ASTConsumer,
-                     public DynamicRecursiveASTVisitor {
-  public:
-    ASTDeclNodeLister(raw_ostream *Out = nullptr)
-        : Out(Out ? *Out : llvm::outs()) {
-      ShouldWalkTypesOfTypeLocs = false;
-    }
+class ASTDeclNodeLister : public ASTConsumer,
+                          public DynamicRecursiveASTVisitor {
+public:
+  ASTDeclNodeLister(raw_ostream *Out = nullptr)
+      : Out(Out ? *Out : llvm::outs()) {
+    ShouldWalkTypesOfTypeLocs = false;
+  }
 
-    void HandleTranslationUnit(ASTContext &Context) override {
-      TraverseDecl(Context.getTranslationUnitDecl());
-    }
+  void HandleTranslationUnit(ASTContext &Context) override {
+    TraverseDecl(Context.getTranslationUnitDecl());
+  }
 
-    bool VisitNamedDecl(NamedDecl *D) override {
-      D->printQualifiedName(Out);
-      Out << '\n';
-      return true;
-    }
+  bool VisitNamedDecl(NamedDecl *D) override {
+    D->printQualifiedName(Out);
+    Out << '\n';
+    return true;
+  }
 
-  private:
-    raw_ostream &Out;
-  };
+private:
+  raw_ostream &Out;
+};
 } // end anonymous namespace
 
 std::unique_ptr<ASTConsumer>
diff --git a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
index 2473ad50ab..9644fe7328 100644
--- a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
+++ b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/AST/Mangle.h"
 #include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/AST/Mangle.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendActions.h"
diff --git a/clang/lib/Index/IndexBody.cpp b/clang/lib/Index/IndexBody.cpp
index 8628a2dcda..215605b45c 100644
--- a/clang/lib/Index/IndexBody.cpp
+++ b/clang/lib/Index/IndexBody.cpp
@@ -10,10 +10,10 @@
 #include "clang/AST/ASTConcept.h"
 #include "clang/AST/ASTLambda.h"
 #include "clang/AST/DeclCXX.h"
+#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/ExprCXX.h"
-#include "clang/AST/ExprObjC.h"
 #include "clang/AST/ExprConcepts.h"
-#include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/AST/ExprObjC.h"
 #include "clang/AST/Type.h"
 
 using namespace clang;
@@ -31,9 +31,9 @@ class BodyIndexer final : public DynamicRecursiveASTVisitor {
     return StmtStack.size() < 2 ? nullptr : StmtStack.end()[-2];
   }
 public:
-  BodyIndexer(IndexingContext &indexCtx,
-              const NamedDecl *Parent, const DeclContext *DC)
-    : IndexCtx(indexCtx), Parent(Parent), ParentDC(DC) {
+  BodyIndexer(IndexingContext &indexCtx, const NamedDecl *Parent,
+              const DeclContext *DC)
+      : IndexCtx(indexCtx), Parent(Parent), ParentDC(DC) {
     ShouldWalkTypesOfTypeLocs = false;
   }
 
@@ -197,7 +197,8 @@ public:
                                     Relations, E);
   }
 
-  bool VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E) override {
+  bool
+  VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E) override {
     const DeclarationNameInfo &Info = E->getMemberNameInfo();
     return indexDependentReference(
         E, E->getBaseType().getTypePtrOrNull(), Info,
@@ -474,7 +475,7 @@ public:
     return true;
   }
 
-  bool VisitParmVarDecl(ParmVarDecl* D) override {
+  bool VisitParmVarDecl(ParmVarDecl *D) override {
     // Index the parameters of lambda expression and requires expression.
     if (IndexCtx.shouldIndexFunctionLocalSymbols()) {
       const auto *DC = D->getDeclContext();
diff --git a/clang/lib/Index/IndexTypeSourceInfo.cpp b/clang/lib/Index/IndexTypeSourceInfo.cpp
index 9c44847688..0abcc2e343 100644
--- a/clang/lib/Index/IndexTypeSourceInfo.cpp
+++ b/clang/lib/Index/IndexTypeSourceInfo.cpp
@@ -9,8 +9,8 @@
 #include "IndexingContext.h"
 #include "clang/AST/ASTConcept.h"
 #include "clang/AST/DeclObjC.h"
-#include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/TypeLoc.h"
 #include "llvm/ADT/ScopeExit.h"
 
@@ -160,7 +160,8 @@ public:
     }
   }
 
-  bool VisitTemplateSpecializationTypeLoc(TemplateSpecializationTypeLoc TL) override {
+  bool VisitTemplateSpecializationTypeLoc(
+      TemplateSpecializationTypeLoc TL) override {
     auto *T = TL.getTypePtr();
     if (!T)
       return true;
@@ -170,7 +171,8 @@ public:
     return true;
   }
 
-  bool TraverseTemplateSpecializationTypeLoc(TemplateSpecializationTypeLoc TL) override {
+  bool TraverseTemplateSpecializationTypeLoc(
+      TemplateSpecializationTypeLoc TL) override {
     if (!WalkUpFromTemplateSpecializationTypeLoc(TL))
       return false;
     if (!TraverseTemplateName(TL.getTypePtr()->getTemplateName()))
@@ -190,7 +192,8 @@ public:
     return true;
   }
 
-  bool VisitDeducedTemplateSpecializationTypeLoc(DeducedTemplateSpecializationTypeLoc TL) override {
+  bool VisitDeducedTemplateSpecializationTypeLoc(
+      DeducedTemplateSpecializationTypeLoc TL) override {
     auto *T = TL.getTypePtr();
     if (!T)
       return true;
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp
index c894b358bf..647c257cad 100644
--- a/clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -16,13 +16,13 @@
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclObjC.h"
+#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/EvaluatedExprVisitor.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/OperationKinds.h"
 #include "clang/AST/ParentMap.h"
-#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/StmtCXX.h"
 #include "clang/AST/StmtObjC.h"
 #include "clang/AST/StmtVisitor.h"
@@ -1067,82 +1067,79 @@ static bool DiagnoseUninitializedUse(Sema &S, const VarDecl *VD,
 }
 
 namespace {
-  class FallthroughMapper final : public DynamicRecursiveASTVisitor {
-  public:
-    FallthroughMapper(Sema &S)
-      : FoundSwitchStatements(false),
-        S(S) {
-      ShouldWalkTypesOfTypeLocs = false;
-    }
+class FallthroughMapper final : public DynamicRecursiveASTVisitor {
+public:
+  FallthroughMapper(Sema &S) : FoundSwitchStatements(false), S(S) {
+    ShouldWalkTypesOfTypeLocs = false;
+  }
 
-    bool foundSwitchStatements() const { return FoundSwitchStatements; }
+  bool foundSwitchStatements() const { return FoundSwitchStatements; }
 
-    void markFallthroughVisited(const AttributedStmt *Stmt) {
-      bool Found = FallthroughStmts.erase(Stmt);
-      assert(Found);
-      (void)Found;
-    }
+  void markFallthroughVisited(const AttributedStmt *Stmt) {
+    bool Found = FallthroughStmts.erase(Stmt);
+    assert(Found);
+    (void)Found;
+  }
+
+  typedef llvm::SmallPtrSet<const AttributedStmt *, 8> AttrStmts;
 
-    typedef llvm::SmallPtrSet<const AttributedStmt*, 8> AttrStmts;
+  const AttrStmts &getFallthroughStmts() const { return FallthroughStmts; }
 
-    const AttrStmts &getFallthroughStmts() const {
-      return FallthroughStmts;
+  void fillReachableBlocks(CFG *Cfg) {
+    assert(ReachableBlocks.empty() && "ReachableBlocks already filled");
+    std::deque<const CFGBlock *> BlockQueue;
+
+    ReachableBlocks.insert(&Cfg->getEntry());
+    BlockQueue.push_back(&Cfg->getEntry());
+    // Mark all case blocks reachable to avoid problems with switching on
+    // constants, covered enums, etc.
+    // These blocks can contain fall-through annotations, and we don't want to
+    // issue a warn_fallthrough_attr_unreachable for them.
+    for (const auto *B : *Cfg) {
+      const Stmt *L = B->getLabel();
+      if (isa_and_nonnull<SwitchCase>(L) && ReachableBlocks.insert(B).second)
+        BlockQueue.push_back(B);
     }
 
-    void fillReachableBlocks(CFG *Cfg) {
-      assert(ReachableBlocks.empty() && "ReachableBlocks already filled");
-      std::deque<const CFGBlock *> BlockQueue;
-
-      ReachableBlocks.insert(&Cfg->getEntry());
-      BlockQueue.push_back(&Cfg->getEntry());
-      // Mark all case blocks reachable to avoid problems with switching on
-      // constants, covered enums, etc.
-      // These blocks can contain fall-through annotations, and we don't want to
-      // issue a warn_fallthrough_attr_unreachable for them.
-      for (const auto *B : *Cfg) {
-        const Stmt *L = B->getLabel();
-        if (isa_and_nonnull<SwitchCase>(L) && ReachableBlocks.insert(B).second)
+    while (!BlockQueue.empty()) {
+      const CFGBlock *P = BlockQueue.front();
+      BlockQueue.pop_front();
+      for (const CFGBlock *B : P->succs()) {
+        if (B && ReachableBlocks.insert(B).second)
           BlockQueue.push_back(B);
       }
-
-      while (!BlockQueue.empty()) {
-        const CFGBlock *P = BlockQueue.front();
-        BlockQueue.pop_front();
-        for (const CFGBlock *B : P->succs()) {
-          if (B && ReachableBlocks.insert(B).second)
-            BlockQueue.push_back(B);
-        }
-      }
     }
+  }
 
-    bool checkFallThroughIntoBlock(const CFGBlock &B, int &AnnotatedCnt,
-                                   bool IsTemplateInstantiation) {
-      assert(!ReachableBlocks.empty() && "ReachableBlocks empty");
+  bool checkFallThroughIntoBlock(const CFGBlock &B, int &AnnotatedCnt,
+                                 bool IsTemplateInstantiation) {
+    assert(!ReachableBlocks.empty() && "ReachableBlocks empty");
 
-      int UnannotatedCnt = 0;
-      AnnotatedCnt = 0;
+    int UnannotatedCnt = 0;
+    AnnotatedCnt = 0;
 
-      std::deque<const CFGBlock*> BlockQueue(B.pred_begin(), B.pred_end());
-      while (!BlockQueue.empty()) {
-        const CFGBlock *P = BlockQueue.front();
-        BlockQueue.pop_front();
-        if (!P) continue;
+    std::deque<const CFGBlock *> BlockQueue(B.pred_begin(), B.pred_end());
+    while (!BlockQueue.empty()) {
+      const CFGBlock *P = BlockQueue.front();
+      BlockQueue.pop_front();
+      if (!P)
+        continue;
 
-        const Stmt *Term = P->getTerminatorStmt();
-        if (isa_and_nonnull<SwitchStmt>(Term))
-          continue; // Switch statement, good.
+      const Stmt *Term = P->getTerminatorStmt();
+      if (isa_and_nonnull<SwitchStmt>(Term))
+        continue; // Switch statement, good.
 
-        const SwitchCase *SW = dyn_cast_or_null<SwitchCase>(P->getLabel());
-        if (SW && SW->getSubStmt() == B.getLabel() && P->begin() == P->end())
-          continue; // Previous case label has no statements, good.
+      const SwitchCase *SW = dyn_cast_or_null<SwitchCase>(P->getLabel());
+      if (SW && SW->getSubStmt() == B.getLabel() && P->begin() == P->end())
+        continue; // Previous case label has no statements, good.
 
-        const LabelStmt *L = dyn_cast_or_null<LabelStmt>(P->getLabel());
-        if (L && L->getSubStmt() == B.getLabel() && P->begin() == P->end())
-          continue; // Case label is preceded with a normal label, good.
+      const LabelStmt *L = dyn_cast_or_null<LabelStmt>(P->getLabel());
+      if (L && L->getSubStmt() == B.getLabel() && P->begin() == P->end())
+        continue; // Case label is preceded with a normal label, good.
 
-        if (!ReachableBlocks.count(P)) {
-          for (const CFGElement &Elem : llvm::reverse(*P)) {
-            if (std::optional<CFGStmt> CS = Elem.getAs<CFGStmt>()) {
+      if (!ReachableBlocks.count(P)) {
+        for (const CFGElement &Elem : llvm::reverse(*P)) {
+          if (std::optional<CFGStmt> CS = Elem.getAs<CFGStmt>()) {
             if (const AttributedStmt *AS = asFallThroughAttr(CS->getStmt())) {
               // Don't issue a warning for an unreachable fallthrough
               // attribute in template instantiations as it may not be
@@ -1240,7 +1237,7 @@ namespace {
     AttrStmts FallthroughStmts;
     Sema &S;
     llvm::SmallPtrSet<const CFGBlock *, 16> ReachableBlocks;
-  };
+};
 } // anonymous namespace
 
 static StringRef getFallthroughAttrSpelling(Preprocessor &PP,
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 3a7819a924..21dfa10e46 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -15,6 +15,7 @@
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/DeclTemplate.h"
+#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprConcepts.h"
@@ -22,7 +23,6 @@
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/OperationKinds.h"
 #include "clang/AST/QualTypeNames.h"
-#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/Type.h"
 #include "clang/Basic/AttributeCommonInfo.h"
 #include "clang/Basic/CharInfo.h"
@@ -5442,7 +5442,8 @@ private:
     }
 
     // In T.foo or T->foo, `foo` is a member function/variable.
-    bool VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E) override {
+    bool
+    VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E) override {
       const Type *Base = E->getBaseType().getTypePtr();
       bool IsArrow = E->isArrow();
       if (Base->isPointerType() && IsArrow) {
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index afe83780a7..3f767a1e2c 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -17,10 +17,10 @@
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/DeclTemplate.h"
+#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/Mangle.h"
-#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/Type.h"
 #include "clang/Basic/CharInfo.h"
 #include "clang/Basic/Cuda.h"
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 5c79c0d5e4..9b745716b3 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -2499,7 +2499,8 @@ void Sema::DiagnoseImmediateEscalatingReason(FunctionDecl *FD) {
   assert(FD->isImmediateEscalating() && !FD->isConsteval() &&
          "expected an immediate function");
   assert(FD->hasBody() && "expected the function to have a body");
-  struct ImmediateEscalatingExpressionsVisitor final : DynamicRecursiveASTVisitor {
+  struct ImmediateEscalatingExpressionsVisitor final
+      : DynamicRecursiveASTVisitor {
     Sema &SemaRef;
 
     const FunctionDecl *ImmediateFn;
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 3dfe5d3d33..42909dbe0f 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -15,9 +15,9 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTMutationListener.h"
 #include "clang/AST/DeclObjC.h"
+#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprObjC.h"
-#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Sema/DeclSpec.h"
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index 3568408785..a78bf785fd 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -10,8 +10,8 @@
 
 #include "clang/Sema/SemaHLSL.h"
 #include "clang/AST/Decl.h"
-#include "clang/AST/Expr.h"
 #include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/AST/Expr.h"
 #include "clang/Basic/DiagnosticSema.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/TargetInfo.h"
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index dc767f53a2..890810888c 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -20,10 +20,10 @@
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/DeclarationName.h"
+#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/NestedNameSpecifier.h"
-#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/TemplateBase.h"
 #include "clang/AST/TemplateName.h"
 #include "clang/AST/Type.h"
diff --git a/clang/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp
index 2754429735..582bcfaec8 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
 #include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/Checker.h"
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
diff --git a/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
index 3ec46f0555..d51b42bcb9 100644
--- a/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
@@ -13,8 +13,8 @@
 
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Attr.h"
-#include "clang/AST/ParentMap.h"
 #include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/AST/ParentMap.h"
 #include "clang/Analysis/Analyses/LiveVariables.h"
 #include "clang/Lex/Lexer.h"
 #include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
diff --git a/clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp b/clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
index a540bc4369..2c48c61563 100644
--- a/clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
@@ -20,8 +20,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/AST/ParentMap.h"
 #include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/AST/ParentMap.h"
 #include "clang/Basic/Builtins.h"
 #include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
@@ -711,7 +711,7 @@ static bool isObjCTypeParamDependent(QualType Type) {
   // an Objective-C type can only be dependent on a type parameter when the type
   // parameter structurally present in the type itself.
   class IsObjCTypeParamDependentTypeVisitor final
-      : public DynamicRecursiveASTVisitor  {
+      : public DynamicRecursiveASTVisitor {
   public:
     IsObjCTypeParamDependentTypeVisitor() = default;
     bool VisitObjCTypeParamType(ObjCTypeParamType *Type) override {
diff --git a/clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp
index be98a3e58a..dba3260bc8 100644
--- a/clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp
@@ -15,8 +15,8 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
 #include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/Checker.h"
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
diff --git a/clang/lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp
index 55e4dcddfd..4135a374df 100644
--- a/clang/lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp
@@ -12,12 +12,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
-#include "clang/Analysis/PathDiagnostic.h"
 #include "clang/AST/DeclObjC.h"
+#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprObjC.h"
-#include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/Analysis/PathDiagnostic.h"
+#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
 #include "clang/StaticAnalyzer/Core/Checker.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
diff --git a/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
index 9dbf63079e..d64469bb09 100644
--- a/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
@@ -11,12 +11,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
 #include "clang/AST/CharUnits.h"
 #include "clang/AST/DeclTemplate.h"
-#include "clang/AST/RecordLayout.h"
 #include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/AST/RecordLayout.h"
 #include "clang/Driver/DriverDiagnostic.h"
+#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/Checker.h"
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp
index 3748cf1590..720fda5714 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp
@@ -12,8 +12,8 @@
 #include "clang/AST/CXXInheritance.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"
-#include "clang/AST/ParentMapContext.h"
 #include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/AST/ParentMapContext.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
diff --git a/clang/lib/Tooling/ASTDiff/ASTDiff.cpp b/clang/lib/Tooling/ASTDiff/ASTDiff.cpp
index ec4f5b9483..74e225a95f 100644
--- a/clang/lib/Tooling/ASTDiff/ASTDiff.cpp
+++ b/clang/lib/Tooling/ASTDiff/ASTDiff.cpp
@@ -11,9 +11,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/Tooling/ASTDiff/ASTDiff.h"
+#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ParentMapContext.h"
-#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Lex/Lexer.h"
 #include "llvm/ADT/PriorityQueue.h"
diff --git a/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp b/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
index f0f27c005b..2b530a3b62 100644
--- a/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
+++ b/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
@@ -104,7 +104,6 @@ public:
     return std::vector<std::string>(USRSet.begin(), USRSet.end());
   }
 
-
   bool VisitCXXMethodDecl(CXXMethodDecl *MethodDecl) override {
     if (MethodDecl->isVirtual())
       OverriddenMethods.push_back(MethodDecl);
diff --git a/clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp b/clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
index 8e8271648a..9caa818bde 100644
--- a/clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
+++ b/clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
@@ -15,8 +15,8 @@
 
 #include "clang/Tooling/Refactoring/Rename/USRLocFinder.h"
 #include "clang/AST/ASTContext.h"
-#include "clang/AST/ParentMapContext.h"
 #include "clang/AST/DynamicRecursiveASTVisitor.h"
+#include "clang/AST/ParentMapContext.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
diff --git a/clang/unittests/AST/EvaluateAsRValueTest.cpp b/clang/unittests/AST/EvaluateAsRValueTest.cpp
index 2645d3c8e0..1e17330863 100644
--- a/clang/unittests/AST/EvaluateAsRValueTest.cpp
+++ b/clang/unittests/AST/EvaluateAsRValueTest.cpp
@@ -29,7 +29,7 @@ typedef std::map<std::string, bool> VarInfoMap;
 /// \brief Records information on variable initializers to a map.
 class EvaluateConstantInitializersVisitor
     : public clang::DynamicRecursiveASTVisitor {
- public:
+public:
   explicit EvaluateConstantInitializersVisitor(VarInfoMap &VarInfo)
       : VarInfo(VarInfo) {}
 
diff --git a/clang/unittests/Analysis/CloneDetectionTest.cpp b/clang/unittests/Analysis/CloneDetectionTest.cpp
index a07bbc780a..f6b2eb1897 100644
--- a/clang/unittests/Analysis/CloneDetectionTest.cpp
+++ b/clang/unittests/Analysis/CloneDetectionTest.cpp
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/Analysis/CloneDetection.h"
+#include "clang/AST/DynamicRecursiveASTVisitor.h"
 #include "clang/Tooling/Tooling.h"
 #include "gtest/gtest.h"
 
diff --git a/clang/unittests/Tooling/CommentHandlerTest.cpp b/clang/unittests/Tooling/CommentHandlerTest.cpp
index d7184b0807..edfb72e2ec 100644
--- a/clang/unittests/Tooling/CommentHandlerTest.cpp
+++ b/clang/unittests/Tooling/CommentHandlerTest.cpp
@@ -22,8 +22,7 @@ struct Comment {
 class CommentVerifier;
 typedef std::vector<Comment> CommentList;
 
-class CommentHandlerVisitor : public TestVisitor,
-                              public CommentHandler {
+class CommentHandlerVisitor : public TestVisitor, public CommentHandler {
 public:
   CommentHandlerVisitor() : PP(nullptr), Verified(false) {}
 
diff --git a/clang/unittests/Tooling/ExecutionTest.cpp b/clang/unittests/Tooling/ExecutionTest.cpp
index 1bfe6293f3..b0fd7ccb95 100644
--- a/clang/unittests/Tooling/ExecutionTest.cpp
+++ b/clang/unittests/Tooling/ExecutionTest.cpp
@@ -30,9 +30,8 @@ namespace {
 
 // This traverses the AST and outputs function name as key and "1" as value for
 // each function declaration.
-class ASTConsumerWithResult
-    : public ASTConsumer,
-      public DynamicRecursiveASTVisitor {
+class ASTConsumerWithResult : public ASTConsumer,
+                              public DynamicRecursiveASTVisitor {
 public:
   explicit ASTConsumerWithResult(ExecutionContext *Context) : Context(Context) {
     assert(Context != nullptr);
diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTestDeclVisitor.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTestDeclVisitor.cpp
index ccd3048b82..6712138b23 100644
--- a/clang/unittests/Tooling/RecursiveASTVisitorTestDeclVisitor.cpp
+++ b/clang/unittests/Tooling/RecursiveASTVisitorTestDeclVisitor.cpp
@@ -14,10 +14,10 @@ namespace {
 
 class VarDeclVisitor : public ExpectedLocationVisitor {
 public:
- bool VisitVarDecl(VarDecl *Variable) override {
-   Match(Variable->getNameAsString(), Variable->getBeginLoc());
-   return true;
- }
+  bool VisitVarDecl(VarDecl *Variable) override {
+    Match(Variable->getNameAsString(), Variable->getBeginLoc());
+    return true;
+  }
 };
 
 TEST(RecursiveASTVisitor, VisitsCXXForRangeStmtLoopVariable) {
@@ -31,9 +31,7 @@ TEST(RecursiveASTVisitor, VisitsCXXForRangeStmtLoopVariable) {
 
 class ParmVarDeclVisitorForImplicitCode : public ExpectedLocationVisitor {
 public:
-  ParmVarDeclVisitorForImplicitCode() {
-    ShouldVisitImplicitCode = true;
-  }
+  ParmVarDeclVisitorForImplicitCode() { ShouldVisitImplicitCode = true; }
 
   bool VisitParmVarDecl(ParmVarDecl *ParamVar) override {
     Match(ParamVar->getNameAsString(), ParamVar->getBeginLoc());
diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTests/Attr.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTests/Attr.cpp
index bbec767ae6..7693e77236 100644
--- a/clang/unittests/Tooling/RecursiveASTVisitorTests/Attr.cpp
+++ b/clang/unittests/Tooling/RecursiveASTVisitorTests/Attr.cpp
@@ -30,7 +30,6 @@ public:
   }
 };
 
-
 TEST(RecursiveASTVisitor, AttributesAreVisited) {
   AttrVisitor Visitor;
   Visitor.ExpectMatch("Attr", 4, 24);
diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTests/Class.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTests/Class.cpp
index 90953c66f6..79dc84b2fd 100644
--- a/clang/unittests/Tooling/RecursiveASTVisitorTests/Class.cpp
+++ b/clang/unittests/Tooling/RecursiveASTVisitorTests/Class.cpp
@@ -18,7 +18,7 @@ class ClassVisitor : public ExpectedLocationVisitor {
 public:
   ClassVisitor() : SawNonImplicitLambdaClass(false) {}
 
-  bool VisitCXXRecordDecl(CXXRecordDecl* record) override {
+  bool VisitCXXRecordDecl(CXXRecordDecl *record) override {
     if (record->isLambda() && !record->isImplicit())
       SawNonImplicitLambdaClass = true;
     return true;
diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTests/Concept.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTests/Concept.cpp
index 3c8781d28e..6dd28e27d7 100644
--- a/clang/unittests/Tooling/RecursiveASTVisitorTests/Concept.cpp
+++ b/clang/unittests/Tooling/RecursiveASTVisitorTests/Concept.cpp
@@ -52,9 +52,10 @@ struct ConceptVisitor : ExpectedLocationVisitor {
 TEST(RecursiveASTVisitor, Concepts) {
   {
     ConceptVisitor Visitor{true};
-    EXPECT_TRUE(Visitor.runOver("template <typename T> concept Fooable = true;\n"
-                                "template <Fooable T> void bar(T);",
-                                ConceptVisitor::Lang_CXX2a));
+    EXPECT_TRUE(
+        Visitor.runOver("template <typename T> concept Fooable = true;\n"
+                        "template <Fooable T> void bar(T);",
+                        ConceptVisitor::Lang_CXX2a));
     // Check that we traverse the "Fooable T" template parameter's
     // TypeConstraint's ImmediatelyDeclaredConstraint, which is a
     // ConceptSpecializationExpr.
@@ -67,9 +68,10 @@ TEST(RecursiveASTVisitor, Concepts) {
 
   {
     ConceptVisitor Visitor; // Don't visit implicit code now.
-    EXPECT_TRUE(Visitor.runOver("template <typename T> concept Fooable = true;\n"
-                                "template <Fooable T> void bar(T);",
-                                ConceptVisitor::Lang_CXX2a));
+    EXPECT_TRUE(
+        Visitor.runOver("template <typename T> concept Fooable = true;\n"
+                        "template <Fooable T> void bar(T);",
+                        ConceptVisitor::Lang_CXX2a));
     // Check that we only visit the TypeConstraint, but not the implicitly
     // generated immediately declared expression.
     EXPECT_EQ(0, Visitor.ConceptSpecializationExprsVisited);
@@ -80,14 +82,15 @@ TEST(RecursiveASTVisitor, Concepts) {
 
   {
     ConceptVisitor Visitor;
-    EXPECT_TRUE(Visitor.runOver("template <class T> concept A = true;\n"
-                                "template <class T> struct vector {};\n"
-                                "template <class T> concept B = requires(T x) {\n"
-                                "  typename vector<T*>;\n"
-                                "  {x} -> A;\n"
-                                "  requires true;\n"
-                                "};",
-                                ConceptVisitor::Lang_CXX2a));
+    EXPECT_TRUE(
+        Visitor.runOver("template <class T> concept A = true;\n"
+                        "template <class T> struct vector {};\n"
+                        "template <class T> concept B = requires(T x) {\n"
+                        "  typename vector<T*>;\n"
+                        "  {x} -> A;\n"
+                        "  requires true;\n"
+                        "};",
+                        ConceptVisitor::Lang_CXX2a));
     EXPECT_EQ(3, Visitor.ConceptRequirementsTraversed);
     EXPECT_EQ(1, Visitor.ConceptReferencesTraversed);
     EXPECT_EQ(1, Visitor.ConceptReferencesVisited);
@@ -114,9 +117,7 @@ struct Foo<F>  {};
 }
 
 struct VisitDeclOnlyOnce : ExpectedLocationVisitor {
-  VisitDeclOnlyOnce() {
-    ShouldWalkTypesOfTypeLocs = false;
-  }
+  VisitDeclOnlyOnce() { ShouldWalkTypesOfTypeLocs = false; }
 
   bool VisitConceptDecl(ConceptDecl *D) override {
     ++ConceptDeclsVisited;
diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTests/ConstructExpr.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTests/ConstructExpr.cpp
index 6e295be5a2..7b2ed9715a 100644
--- a/clang/unittests/Tooling/RecursiveASTVisitorTests/ConstructExpr.cpp
+++ b/clang/unittests/Tooling/RecursiveASTVisitorTests/ConstructExpr.cpp
@@ -18,13 +18,11 @@ namespace {
 /// The name recorded for the match is the name of the class whose constructor
 /// is invoked by the CXXConstructExpr, not the name of the class whose
 /// constructor the CXXConstructExpr is contained in.
-class ConstructExprVisitor : public ExpectedLocationVisitor  {
+class ConstructExprVisitor : public ExpectedLocationVisitor {
 public:
-  ConstructExprVisitor() {
-    ShouldVisitImplicitCode = false;
-  }
+  ConstructExprVisitor() { ShouldVisitImplicitCode = false; }
 
-  bool VisitCXXConstructExpr(CXXConstructExpr* Expr) override {
+  bool VisitCXXConstructExpr(CXXConstructExpr *Expr) override {
     if (const CXXConstructorDecl* Ctor = Expr->getConstructor()) {
       if (const CXXRecordDecl* Class = Ctor->getParent()) {
         Match(Class->getName(), Expr->getLocation());
diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTests/DeclRefExpr.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTests/DeclRefExpr.cpp
index 653e9c8bdf..6ed986c187 100644
--- a/clang/unittests/Tooling/RecursiveASTVisitorTests/DeclRefExpr.cpp
+++ b/clang/unittests/Tooling/RecursiveASTVisitorTests/DeclRefExpr.cpp
@@ -14,9 +14,7 @@ namespace {
 
 class DeclRefExprVisitor : public ExpectedLocationVisitor {
 public:
-  DeclRefExprVisitor() {
-    ShouldVisitImplicitCode = false;
-  }
+  DeclRefExprVisitor() { ShouldVisitImplicitCode = false; }
 
   bool VisitDeclRefExpr(DeclRefExpr *Reference) override {
     Match(Reference->getNameInfo().getAsString(), Reference->getLocation());
diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTests/ImplicitCtor.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTests/ImplicitCtor.cpp
index f67cff2586..dc9455a01e 100644
--- a/clang/unittests/Tooling/RecursiveASTVisitorTests/ImplicitCtor.cpp
+++ b/clang/unittests/Tooling/RecursiveASTVisitorTests/ImplicitCtor.cpp
@@ -15,7 +15,7 @@ namespace {
 // A visitor that visits implicit declarations and matches constructors.
 class ImplicitCtorVisitor : public ExpectedLocationVisitor {
 public:
-    bool VisitCXXConstructorDecl(CXXConstructorDecl* Ctor) override {
+  bool VisitCXXConstructorDecl(CXXConstructorDecl *Ctor) override {
     if (Ctor->isImplicit()) {  // Was not written in source code
       if (const CXXRecordDecl* Class = Ctor->getParent()) {
         Match(Class->getName(), Ctor->getLocation());
diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaExpr.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaExpr.cpp
index af84c6ef9a..0ce7f4b187 100644
--- a/clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaExpr.cpp
+++ b/clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaExpr.cpp
@@ -16,9 +16,7 @@ namespace {
 
 class LambdaExprVisitor : public ExpectedLocationVisitor {
 public:
-  LambdaExprVisitor() {
-    ShouldVisitImplicitCode = false;
-  }
+  LambdaExprVisitor() { ShouldVisitImplicitCode = false; }
 
   bool VisitLambdaExpr(LambdaExpr *Lambda) override {
     PendingBodies.push(Lambda->getBody());
diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaTemplateParams.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaTemplateParams.cpp
index 77194b04de..cfac3a3c5a 100644
--- a/clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaTemplateParams.cpp
+++ b/clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaTemplateParams.cpp
@@ -15,9 +15,7 @@ namespace {
 // Matches (optional) explicit template parameters.
 class LambdaTemplateParametersVisitor : public ExpectedLocationVisitor {
 public:
-  LambdaTemplateParametersVisitor() {
-    ShouldVisitImplicitCode = false;
-  }
+  LambdaTemplateParametersVisitor() { ShouldVisitImplicitCode = false; }
 
   bool VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) override {
     EXPECT_FALSE(D->isImplicit());
diff --git a/clang/unittests/Tooling/TestVisitor.h b/clang/unittests/Tooling/TestVisitor.h
index cf39fc1435..fdf57a946a 100644
--- a/clang/unittests/Tooling/TestVisitor.h
+++ b/clang/unittests/Tooling/TestVisitor.h
@@ -49,11 +49,21 @@ public:
       Args.push_back("-x");
       Args.push_back("c");
       break;
-    case Lang_CXX98: Args.push_back("-std=c++98"); break;
-    case Lang_CXX11: Args.push_back("-std=c++11"); break;
-    case Lang_CXX14: Args.push_back("-std=c++14"); break;
-    case Lang_CXX17: Args.push_back("-std=c++17"); break;
-    case Lang_CXX2a: Args.push_back("-std=c++2a"); break;
+    case Lang_CXX98:
+      Args.push_back("-std=c++98");
+      break;
+    case Lang_CXX11:
+      Args.push_back("-std=c++11");
+      break;
+    case Lang_CXX14:
+      Args.push_back("-std=c++14");
+      break;
+    case Lang_CXX17:
+      Args.push_back("-std=c++17");
+      break;
+    case Lang_CXX2a:
+      Args.push_back("-std=c++2a");
+      break;
     case Lang_OBJC:
       Args.push_back("-ObjC");
       Args.push_back("-fobjc-runtime=macosx-10.12.0");
@@ -70,7 +80,7 @@ public:
 protected:
   TestVisitorHelper() = default;
   virtual ~TestVisitorHelper() = default;
-  virtual void InvokeTraverseDecl(TranslationUnitDecl* D) = 0;
+  virtual void InvokeTraverseDecl(TranslationUnitDecl *D) = 0;
 
   virtual std::unique_ptr<ASTFrontendAction> CreateTestAction() {
     return std::make_unique<TestAction>(this);
@@ -130,14 +140,15 @@ public:
   virtual ~ExpectedLocationVisitorHelper() {
     // FIXME: Range-based for loop.
     for (std::vector<ExpectedMatch>::const_iterator
-             It = ExpectedMatches.begin(), End = ExpectedMatches.end();
+             It = ExpectedMatches.begin(),
+             End = ExpectedMatches.end();
          It != End; ++It) {
       It->ExpectFound();
-         }
+    }
   }
 
 protected:
-  virtual ASTContext* getASTContext() = 0;
+  virtual ASTContext *getASTContext() = 0;
 
   /// \brief Checks an actual match against expected and disallowed matches.
   ///
@@ -148,18 +159,19 @@ protected:
 
     // FIXME: Range-based for loop.
     for (std::vector<MatchCandidate>::const_iterator
-             It = DisallowedMatches.begin(), End = DisallowedMatches.end();
+             It = DisallowedMatches.begin(),
+             End = DisallowedMatches.end();
          It != End; ++It) {
       EXPECT_FALSE(It->Matches(Name, FullLocation))
           << "Matched disallowed " << *It;
-         }
+    }
 
     // FIXME: Range-based for loop.
-    for (std::vector<ExpectedMatch>::iterator
-             It = ExpectedMatches.begin(), End = ExpectedMatches.end();
+    for (std::vector<ExpectedMatch>::iterator It = ExpectedMatches.begin(),
+                                              End = ExpectedMatches.end();
          It != End; ++It) {
       It->UpdateFor(Name, FullLocation, getASTContext()->getSourceManager());
-         }
+    }
   }
 
 private:
@@ -213,7 +225,7 @@ private:
         llvm::raw_string_ostream Stream(PartialMatches);
         Stream << ", partial match: \"" << Name << "\" at ";
         Location.print(Stream, SM);
-                 }
+      }
     }
 
     void ExpectFound() const {
@@ -232,7 +244,7 @@ private:
   std::vector<MatchCandidate> DisallowedMatches;
   std::vector<ExpectedMatch> ExpectedMatches;
 };
-}
+} // namespace detail
 
 /// \brief Base class for simple (Dynamic)RecursiveASTVisitor based tests.
 ///
@@ -251,9 +263,7 @@ public:
     ShouldVisitImplicitCode = true;
   }
 
-  void InvokeTraverseDecl(TranslationUnitDecl* D) override {
-    TraverseDecl(D);
-  }
+  void InvokeTraverseDecl(TranslationUnitDecl *D) override { TraverseDecl(D); }
 };
 
 /// \brief A RecursiveASTVisitor to check that certain matches are (or are
@@ -269,6 +279,6 @@ class ExpectedLocationVisitor : public TestVisitor,
                                 public detail::ExpectedLocationVisitorHelper {
   ASTContext *getASTContext() override { return Context; }
 };
-}
+} // namespace clang
 
 #endif

``````````

</details>


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


More information about the cfe-commits mailing list