[PATCH] D148697: [clang-tidy] Add more checks for functions which should be noexcept

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 13 09:43:40 PDT 2023


PiotrZSL accepted this revision.
PiotrZSL added a comment.

+-LGTM

Only one thing that could be still done here, is to extract some base class from those checks, and move common code there.
I will commit this tomorrow, so if you decide to change anything you can still do that, if not you can always do that in separate patch.



================
Comment at: clang-tools-extra/clang-tidy/performance/NoexceptDestructorCheck.cpp:19-23
+  Finder->addMatcher(functionDecl(unless(isImplicit()), unless(isDeleted()),
+                                  cxxDestructorDecl())
+                         .bind("decl"),
+                     this);
+}
----------------
start with `cxxDestructorDecl(unless(isImplicit())`, ..., no need for functionDecl.
Also here we may have some issues with template dependent code.


================
Comment at: clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp:22
   Finder->addMatcher(
       cxxMethodDecl(unless(isImplicit()), unless(isDeleted()),
                     anyOf(cxxConstructorDecl(isMoveConstructor()),
----------------
I think we could use TK_IgnoreUnlessSpelledInSource instead of all those isImplicit


================
Comment at: clang-tools-extra/clang-tidy/performance/NoexceptSwapCheck.cpp:21
+  Finder->addMatcher(
+      functionDecl(unless(isImplicit()), unless(isDeleted()), hasName("swap"))
+          .bind("decl"),
----------------
i dont think that swap functions can be deleted


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148697



More information about the cfe-commits mailing list