[clang-tools-extra] [clang-tidy] new check readability-mark-static (PR #90830)

via cfe-commits cfe-commits at lists.llvm.org
Fri May 3 00:36:22 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 a370d57b9ff9e385e9a51bf6b1d366890f4091cd 1bb5ed2ebd9e1b40fe581b719181681f71f78fa2 -- clang-tools-extra/clang-tidy/readability/UnnecessaryExternalLinkageCheck.cpp clang-tools-extra/clang-tidy/readability/UnnecessaryExternalLinkageCheck.h clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/mark-static-var/func.h clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/mark-static-var/var.h clang-tools-extra/test/clang-tidy/checkers/readability/unnecessary-external-linkage-func.cpp clang-tools-extra/test/clang-tidy/checkers/readability/unnecessary-external-linkage-var.cpp clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
``````````

</details>

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

``````````diff
diff --git a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
index baa4eec704..d389287e8f 100644
--- a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -32,7 +32,6 @@
 #include "IsolateDeclarationCheck.h"
 #include "MagicNumbersCheck.h"
 #include "MakeMemberFunctionConstCheck.h"
-#include "UnnecessaryExternalLinkageCheck.h"
 #include "MathMissingParenthesesCheck.h"
 #include "MisleadingIndentationCheck.h"
 #include "MisplacedArrayIndexCheck.h"
@@ -59,6 +58,7 @@
 #include "StringCompareCheck.h"
 #include "SuspiciousCallArgumentCheck.h"
 #include "UniqueptrDeleteReleaseCheck.h"
+#include "UnnecessaryExternalLinkageCheck.h"
 #include "UppercaseLiteralSuffixCheck.h"
 #include "UseAnyOfAllOfCheck.h"
 #include "UseStdMinMaxCheck.h"
@@ -107,7 +107,8 @@ public:
         "readability-identifier-naming");
     CheckFactories.registerCheck<ImplicitBoolConversionCheck>(
         "readability-implicit-bool-conversion");
-    CheckFactories.registerCheck<UnnecessaryExternalLinkageCheck>("readability-unnecessary-external-linkage");
+    CheckFactories.registerCheck<UnnecessaryExternalLinkageCheck>(
+        "readability-unnecessary-external-linkage");
     CheckFactories.registerCheck<MathMissingParenthesesCheck>(
         "readability-math-missing-parentheses");
     CheckFactories.registerCheck<RedundantInlineSpecifierCheck>(
diff --git a/clang-tools-extra/clang-tidy/readability/UnnecessaryExternalLinkageCheck.cpp b/clang-tools-extra/clang-tidy/readability/UnnecessaryExternalLinkageCheck.cpp
index fd302f5ab1..4970d3339e 100644
--- a/clang-tools-extra/clang-tidy/readability/UnnecessaryExternalLinkageCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/UnnecessaryExternalLinkageCheck.cpp
@@ -1,4 +1,5 @@
-//===--- UnnecessaryExternalLinkageCheck.cpp - clang-tidy ---------------------------------===//
+//===--- UnnecessaryExternalLinkageCheck.cpp - clang-tidy
+//---------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -65,7 +66,8 @@ static constexpr StringRef Message =
     "marking as static or using anonymous namespace can avoid external "
     "linkage.";
 
-void UnnecessaryExternalLinkageCheck::check(const MatchFinder::MatchResult &Result) {
+void UnnecessaryExternalLinkageCheck::check(
+    const MatchFinder::MatchResult &Result) {
   if (const auto *FD = Result.Nodes.getNodeAs<FunctionDecl>("fn")) {
     diag(FD->getLocation(), Message) << "function" << FD;
     return;

``````````

</details>


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


More information about the cfe-commits mailing list