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 h,cpp --
clang-tools-extra/clang-tidy/readability/RedundantTagCheck.cpp
clang-tools-extra/clang-tidy/readability/RedundantTagCheck.h
clang-tools-extra/test/clang-tidy/checkers/readability/redundant-tag.cpp
clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.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-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
index ab543f618..699eb45c9 100644
--- a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -55,6 +55,7 @@
#include "RedundantSmartptrGetCheck.h"
#include "RedundantStringCStrCheck.h"
#include "RedundantStringInitCheck.h"
+#include "RedundantTagCheck.h"
#include "RedundantTypenameCheck.h"
#include "ReferenceToConstructedTemporaryCheck.h"
#include "SimplifyBooleanExprCheck.h"
@@ -70,8 +71,6 @@
#include "UseAnyOfAllOfCheck.h"
#include "UseConcisePreprocessorDirectivesCheck.h"
#include "UseStdMinMaxCheck.h"
-#include "RedundantTagCheck.h"
-
namespace clang::tidy {
namespace readability {
@@ -205,7 +204,7 @@ public:
CheckFactories.registerCheck<UseStdMinMaxCheck>(
"readability-use-std-min-max");
CheckFactories.registerCheck<RedundantTagCheck>(
- "readability-redundant-tag");
+ "readability-redundant-tag");
}
};
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantTagCheck.cpp
b/clang-tools-extra/clang-tidy/readability/RedundantTagCheck.cpp
index 3ef167376..0958161bc 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantTagCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantTagCheck.cpp
@@ -24,11 +24,8 @@ namespace {
static bool canHideTag(const NamedDecl *D) {
D = D->getUnderlyingDecl();
- return isa<VarDecl>(D) ||
- isa<EnumConstantDecl>(D) ||
- isa<FunctionDecl>(D) ||
- isa<FunctionTemplateDecl>(D) ||
- isa<FieldDecl>(D) ||
+ return isa<VarDecl>(D) || isa<EnumConstantDecl>(D) || isa<FunctionDecl>(D) ||
+ isa<FunctionTemplateDecl>(D) || isa<FieldDecl>(D) ||
isa<UnresolvedUsingValueDecl>(D);
}
@@ -40,8 +37,7 @@ void RedundantTagCheck::registerMatchers(MatchFinder *Finder)
{
this);
}
-void RedundantTagCheck::check(
- const MatchFinder::MatchResult &Result) {
+void RedundantTagCheck::check(const MatchFinder::MatchResult &Result) {
const auto *TL = Result.Nodes.getNodeAs<TypeLoc>("typeLoc");
if (!TL)
return;
@@ -72,23 +68,17 @@ void RedundantTagCheck::check(
return;
Token Tok;
- if (Lexer::getRawToken(KeywordLoc, Tok,
- *Result.SourceManager,
- getLangOpts()))
+ if (Lexer::getRawToken(KeywordLoc, Tok, *Result.SourceManager,
getLangOpts()))
return;
llvm::StringRef Keyword = Tok.getRawIdentifier();
- if (Keyword != "struct" &&
- Keyword != "class" &&
- Keyword != "union" &&
+ if (Keyword != "struct" && Keyword != "class" && Keyword != "union" &&
Keyword != "enum")
return;
- diag(KeywordLoc,
- "redundant '%0' keyword in C++ declaration")
- << Keyword
- << FixItHint::CreateRemoval(KeywordLoc);
+ diag(KeywordLoc, "redundant '%0' keyword in C++ declaration")
+ << Keyword << FixItHint::CreateRemoval(KeywordLoc);
}
-} // namespace clang::tidy::readability
\ No newline at end of file
+} // namespace clang::tidy::readability
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantTagCheck.h
b/clang-tools-extra/clang-tidy/readability/RedundantTagCheck.h
index 0b1e5dcd0..1fb108b5a 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantTagCheck.h
+++ b/clang-tools-extra/clang-tidy/readability/RedundantTagCheck.h
@@ -18,8 +18,7 @@ public:
RedundantTagCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
- bool isLanguageVersionSupported(
- const LangOptions &LangOpts) const override {
+ bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/210007
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits