[clang] [clang-tools-extra] [clang-tidy] New performance linter: performance-inefficient-copy-assign (PR #179467)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 6 05:38:05 PST 2026


================
@@ -0,0 +1,34 @@
+//===--- InefficientCopyAssign.h - 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTCOPYASSIGNCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTCOPYASSIGNCHECK_H
+
+#include "../ClangTidyCheck.h"
+
+#include "clang/Analysis/CFG.h"
+
+namespace clang::tidy::performance {
+
+class InefficientCopyAssignCheck : public ClangTidyCheck {
+  llvm::DenseMap<const FunctionDecl *, std::unique_ptr<CFG>> CFGCache;
+  CFG *getCFG(const FunctionDecl *, ASTContext *);
----------------
vbvictor wrote:

nit: we usually place private fields at the end of the check with `private` specifier.

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


More information about the cfe-commits mailing list