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 866755f8da588ec2efbcac60679b9d9f5c4636a9 
5ee115e7cd83fe5a59c0284e91893b71df79be0c --extensions cpp,h -- 
clang-tools-extra/clang-tidy/modernize/CleanupStaticCastCheck.cpp 
clang-tools-extra/clang-tidy/modernize/CleanupStaticCastCheck.h 
clang-tools-extra/test/clang-tidy/checkers/modernize/modernize-cleanup-static-cast.cpp
 clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
``````````

</details>

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

``````````diff
diff --git a/clang-tools-extra/clang-tidy/modernize/CleanupStaticCastCheck.cpp 
b/clang-tools-extra/clang-tidy/modernize/CleanupStaticCastCheck.cpp
index 1fdb0cff14..f7cb40e32d 100644
--- a/clang-tools-extra/clang-tidy/modernize/CleanupStaticCastCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/CleanupStaticCastCheck.cpp
@@ -18,7 +18,6 @@ using namespace clang::ast_matchers;
 
 namespace clang::tidy::modernize {
 
-
 std::string getText(const clang::Expr *E, const clang::ASTContext &Context) {
   auto &SM = Context.getSourceManager();
   auto Range = clang::CharSourceRange::getTokenRange(E->getSourceRange());
@@ -28,11 +27,10 @@ std::string getText(const clang::Expr *E, const 
clang::ASTContext &Context) {
 void CleanupStaticCastCheck::registerMatchers(MatchFinder *Finder) {
   // Match static_cast expressions not in templates
   Finder->addMatcher(
-      cxxStaticCastExpr(
-          unless(hasAncestor(functionTemplateDecl())),
-          unless(hasAncestor(classTemplateDecl())),
-          unless(isInTemplateInstantiation()))
-      .bind("cast"),
+      cxxStaticCastExpr(unless(hasAncestor(functionTemplateDecl())),
+                        unless(hasAncestor(classTemplateDecl())),
+                        unless(isInTemplateInstantiation()))
+          .bind("cast"),
       this);
 }
 
@@ -52,18 +50,18 @@ void CleanupStaticCastCheck::check(const 
MatchFinder::MatchResult &Result) {
   // Compare canonical types and qualifiers
   SourceType = SourceType.getCanonicalType();
   TargetType = TargetType.getCanonicalType();
-  
+
   if (SourceType == TargetType) {
-    auto Diag = 
+    auto Diag =
         diag(Cast->getBeginLoc(),
-             "redundant static_cast to the same type %0")  // Removed single 
quotes
+             "redundant static_cast to the same type %0") // Removed single
+                                                          // quotes
         << TargetType;
 
     std::string ReplacementText = getText(SubExpr, *Result.Context);
-    
-    Diag << FixItHint::CreateReplacement(
-        Cast->getSourceRange(),
-        ReplacementText);
+
+    Diag << FixItHint::CreateReplacement(Cast->getSourceRange(),
+                                         ReplacementText);
   }
 }
 
diff --git a/clang-tools-extra/clang-tidy/modernize/CleanupStaticCastCheck.h 
b/clang-tools-extra/clang-tidy/modernize/CleanupStaticCastCheck.h
index a96e7cac3f..3c719a7376 100644
--- a/clang-tools-extra/clang-tidy/modernize/CleanupStaticCastCheck.h
+++ b/clang-tools-extra/clang-tidy/modernize/CleanupStaticCastCheck.h
@@ -23,8 +23,8 @@ namespace clang::tidy::modernize {
 ///   foo(s);
 /// \endcode
 ///
-/// Note: This check intentionally ignores redundant casts in template 
instantiations
-/// as they might be needed for other template parameter types.
+/// Note: This check intentionally ignores redundant casts in template
+/// instantiations as they might be needed for other template parameter types.
 class CleanupStaticCastCheck : public ClangTidyCheck {
 public:
   CleanupStaticCastCheck(StringRef Name, ClangTidyContext *Context)
diff --git a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp 
b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
index 364f1d6b20..edb11d8afe 100644
--- a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
@@ -11,6 +11,7 @@
 #include "../ClangTidyModuleRegistry.h"
 #include "AvoidBindCheck.h"
 #include "AvoidCArraysCheck.h"
+#include "CleanupStaticCastCheck.h"
 #include "ConcatNestedNamespacesCheck.h"
 #include "DeprecatedHeadersCheck.h"
 #include "DeprecatedIosBaseAliasesCheck.h"
@@ -42,7 +43,6 @@
 #include "UseNullptrCheck.h"
 #include "UseOverrideCheck.h"
 #include "UseRangesCheck.h"
-#include "CleanupStaticCastCheck.h"
 #include "UseStartsEndsWithCheck.h"
 #include "UseStdFormatCheck.h"
 #include "UseStdNumbersCheck.h"
@@ -124,7 +124,7 @@ public:
         "modernize-use-uncaught-exceptions");
     CheckFactories.registerCheck<UseUsingCheck>("modernize-use-using");
     CheckFactories.registerCheck<CleanupStaticCastCheck>(
-      "modernize-cleanup-static-cast");
+        "modernize-cleanup-static-cast");
   }
 };
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/118033
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to