[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-init: Add a hook... (PR #73921)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 30 07:25:51 PST 2023


================
@@ -32,6 +32,12 @@ class UnnecessaryCopyInitialization : public ClangTidyCheck {
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
   void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
 
+protected:
+  // This is virtual so that derived classes can implement additional behavior.
+  virtual void makeDiagnostic(DiagnosticBuilder Diagnostic, const VarDecl &Var,
----------------
PiotrZSL wrote:

You may consider adding some test, even if it would only derive from this class, create instance of it, and override this method. Simply to make compilation fail when someone change this method.

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


More information about the cfe-commits mailing list