[PATCH] D26167: [Clang-tidy] check for malloc, realloc and free calls

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 12 23:20:59 PST 2016


alexfh requested changes to this revision.
alexfh added a comment.
This revision now requires changes to proceed.

One important thing is missing. Please run this check on a large enough codebase (LLVM + Clang is a good choice for testing most of kinds of checks usually) and include a summary of results in the patch description. The most important things are: clang-tidy doesn't crash, results (or if there are too many, then a sufficiently large random sample - say, 100) look good on manual inspection.



================
Comment at: clang-tidy/cppcoreguidelines/NoMallocCheck.cpp:48
+  if ((Call = Result.Nodes.getNodeAs<CallExpr>("aquisition")))
+    Recommendation = "consider a container or smart pointer";
+
----------------
nit: `a smart pointer` (an article is missing).


================
Comment at: clang-tidy/cppcoreguidelines/NoMallocCheck.cpp:49
+    Recommendation = "consider a container or smart pointer";
+
+  else if ((Call = Result.Nodes.getNodeAs<CallExpr>("realloc")))
----------------
Please remove empty lines before `else`


Repository:
  rL LLVM

https://reviews.llvm.org/D26167





More information about the cfe-commits mailing list