[clang-tools-extra] [clang-tidy] Add misc-shadowed-namespace-function check (PR #168406)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 21 06:54:04 PST 2025
================
@@ -0,0 +1,143 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 "ShadowedNamespaceFunctionCheck.h"
+#include "../utils/FixItHintUtils.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/Decl.h"
+#include "clang/AST/DeclCXX.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallPtrSet.h"
+
+using namespace clang;
+using namespace clang::ast_matchers;
+using namespace clang::tidy;
+
+namespace clang::tidy::misc {
+
+template <typename ContainerTy>
+static auto makeCannonicalTypesRange(ContainerTy &&C) {
+ return llvm::map_range(C, [](const ParmVarDecl *Param) {
+ return Param->getType().getCanonicalType();
+ });
+}
----------------
vbvictor wrote:
Do we need it as a template? If not, can we make it accept `ContainerTy<const ParmVarDecl *>` to specify that we expect a container with `ParmVarDecl`.
I see we only use it once in makeCannonicalTypesRange.
https://github.com/llvm/llvm-project/pull/168406
More information about the cfe-commits
mailing list