[PATCH] D15623: Add UnnecessaryCopyInitialization check to new "performance" module in ClangTidy

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 29 04:24:12 PST 2015


alexfh added a comment.

Thank you for working on this!

A few minor comments.


================
Comment at: clang-tidy/performance/UnnecessaryCopyInitialization.cpp:21
@@ +20,3 @@
+namespace {
+AST_MATCHER(VarDecl, isLocalVarDecl) { return Node.isLocalVarDecl(); }
+AST_MATCHER(QualType, isPointerType) { return Node->isPointerType(); }
----------------
Maybe move this to clang-tidy/utils/Matchers.h?

================
Comment at: clang-tidy/performance/UnnecessaryCopyInitialization.cpp:24
@@ +23,3 @@
+
+Token getPreviousNonCommentToken(const ASTContext &Context,
+                                 SourceLocation Location) {
----------------
This might be useful elsewhere. Let's move it to clang-tidy/utils/LexerUtils.h / .cpp.

================
Comment at: clang-tidy/performance/UnnecessaryCopyInitialization.h:16
@@ +15,3 @@
+namespace clang {
+namespace tidy {
+
----------------
This should also be in the `performance` namespace. The `add_new_check.py` script has been fixed in the meantime.


http://reviews.llvm.org/D15623





More information about the cfe-commits mailing list