[clang-tools-extra] [clang-tidy] Add `readability-redundant-tag` check (PR #210007)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 16 09:33:20 PDT 2026
================
@@ -0,0 +1,87 @@
+//===--- RedundantTagCheck.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.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "RedundantTagCheck.h"
+
+#include "clang/AST/Decl.h"
+#include "clang/AST/DeclTemplate.h"
+#include "clang/AST/TypeLoc.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
+#include "clang/Basic/Diagnostic.h"
+#include "clang/Lex/Lexer.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::readability {
+
+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) ||
+ isa<UnresolvedUsingValueDecl>(D);
+}
+
+} // namespace
----------------
EugeneZelenko wrote:
```suggestion
```
https://github.com/llvm/llvm-project/pull/210007
More information about the cfe-commits
mailing list