[PATCH] D63324: [clang-tidy] Replace memcpy by std::copy

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 14 10:22:34 PDT 2019


Eugene.Zelenko added a comment.

New check must be mentioned in Release Notes and its documentation provided.



================
Comment at: clang-tools-extra/clang-tidy/modernize/ReplaceMemcpyByStdCopy.cpp:68
+                                            const CallExpr *MemcpyNode) {
+  const auto FunctionNameSourceRange = CharSourceRange::getCharRange(
+      MemcpyNode->getBeginLoc(), MemcpyNode->getArg(0)->getBeginLoc());
----------------
Return type could not be deduced from same statement, so please don't use auto.


================
Comment at: clang-tools-extra/clang-tidy/modernize/ReplaceMemcpyByStdCopy.cpp:76
+                                         const CallExpr *MemcpyNode) {
+  std::string arg[3];
+
----------------
Will be good idea to use std::array and its size instead of numerical constant.


================
Comment at: clang-tools-extra/clang-tidy/modernize/ReplaceMemcpyByStdCopy.h:26
+  ReplaceMemcpyByStdCopy(StringRef Name, ClangTidyContext *Context);
+  virtual ~ReplaceMemcpyByStdCopy() {}
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
----------------
Should be override and = default. See modernize-use-override and modernize-use-equals-default.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63324





More information about the cfe-commits mailing list