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

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 16 07:01:32 PDT 2020


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/cert/PlacementNewStorageCheck.cpp:19
+
+namespace {
+const ValueDecl *getDescendantValueDecl(const Stmt *TheStmt) {
----------------
Please use static instead of anonymous namespaces for functions. See LLVM Coding Guidelines.


================
Comment at: clang-tools-extra/clang-tidy/cert/PlacementNewStorageCheck.cpp:21
+const ValueDecl *getDescendantValueDecl(const Stmt *TheStmt) {
+  if (auto TheDeclRefExpr = dyn_cast<DeclRefExpr>(TheStmt))
+    return TheDeclRefExpr->getDecl();
----------------
const auto *. Same in other places.


================
Comment at: clang-tools-extra/clang-tidy/cert/PlacementNewStorageCheck.cpp:47
+void PlacementNewStorageCheck::registerMatchers(MatchFinder *Finder) {
+  if (!getLangOpts().CPlusPlus)
+    return;
----------------
Belongs to isLanguageVersionSupported() now.


================
Comment at: clang-tools-extra/clang-tidy/cert/PlacementNewStorageCheck.cpp:69
+
+    if (auto TheFunctionProtoType = StorageT->getAs<FunctionProtoType>())
+      StorageT = TheFunctionProtoType->getReturnType();
----------------
const auto *. Same below.


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:95
+
+  Checks that placement new provided with properly aligned pointer to
+  sufficient storage capacity.
----------------
Please highlight new with double back-ticks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/cert-mem54-cpp.rst:6
+
+Checks that placement new provided with properly aligned pointer to sufficient storage capacity.
+
----------------
Please highlight new with double back-ticks.


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