[PATCH] D13071: [PATCH] New checker for mismatched operator new/operator delete definitions

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 29 02:50:36 PDT 2015


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

Looks good with a few comments.

Thanks for the new check! Do you think whether this could be a compiler warning some day?


================
Comment at: clang-tidy/misc/NewDeleteOverloadsCheck.cpp:52
@@ +51,3 @@
+
+  const FunctionProtoType *FPT = Node.getType()->castAs<FunctionProtoType>();
+  ASTContext &Ctx = Node.getASTContext();
----------------
nit: `const auto *FPT` would be better here to avoid duplication of the type name.

================
Comment at: clang-tidy/misc/NewDeleteOverloadsCheck.h:22
@@ +21,3 @@
+class NewDeleteOverloadsCheck : public ClangTidyCheck {
+  std::map<const class clang::CXXRecordDecl *,
+           llvm::SmallVector<const class clang::FunctionDecl *, 4>> Overloads;
----------------
I wonder whether "class" here and below is actually needed. Did you try without it?

================
Comment at: test/clang-tidy/misc-new-delete-overloads.cpp:3
@@ +2,3 @@
+
+typedef unsigned int size_t;
+
----------------
I think, "unsigned long" should be used instead (and we might have to define it differently for different platforms).


http://reviews.llvm.org/D13071





More information about the cfe-commits mailing list