[PATCH] D106011: [clang-tidy] performance-unnecessary-copy-initialization: Disable check when variable and initializer have different replaced template param types.

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 16 13:17:39 PDT 2021


ymandel accepted this revision.
ymandel added a comment.
This revision is now accepted and ready to land.

Nice!



================
Comment at: clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp:178-183
+      if (VarTmplType->getReplacedParameter()->desugar().getCanonicalType() !=
+          InitializerTmplType->getReplacedParameter()
+              ->desugar()
+              .getCanonicalType()) {
+        return true;
+      }
----------------
nit: maybe just return the condition (instead of using if(...) return true)? that is
return VarTmpType->... != ...


================
Comment at: clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp:271
+  // template instantiation where the substituted types are the same, but
+  // instantiations where the types differ and rely on implicit convertion would
+  // no longer compile if we switched to a reference.
----------------
typo: conversion


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106011/new/

https://reviews.llvm.org/D106011



More information about the cfe-commits mailing list