[PATCH] D76229: [clang-tidy] Added PlacementNewStorageCheck

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 16 08:42:21 PDT 2020


njames93 added a comment.

Also fix the test case, premerge found a failure



================
Comment at: clang-tools-extra/clang-tidy/cert/PlacementNewStorageCheck.cpp:23
+
+  for (const Stmt *Child : TheStmt->children()) {
+    if (const auto *TheDeclRefExpr = dyn_cast<DeclRefExpr>(Child))
----------------
For better or worse children can sometimes contain nullptr, best to check for that first


================
Comment at: clang-tools-extra/clang-tidy/cert/PlacementNewStorageCheck.cpp:52
+
+void PlacementNewStorageCheck::check(const MatchFinder::MatchResult &Result) {
+  const auto *NewExpr = Result.Nodes.getNodeAs<CXXNewExpr>("new");
----------------
Not gonna say this is blocking anything, but this is quite a large function that could be made smaller (more readable) by moving some of those lambdas out of the function


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76229





More information about the cfe-commits mailing list