[PATCH] D128372: [Clang-Tidy] Empty Check

Denis Nikitin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 27 12:13:48 PDT 2022


denik added a comment.

Thanks for adding a check! Please check my comments.



================
Comment at: clang-tools-extra/clang-tidy/bugprone/StandaloneEmptyCheck.cpp:76
+
+    auto Methods = Arg->getType()->getAsCXXRecordDecl()->methods();
+    auto Clear = llvm::find_if(Methods, [](const CXXMethodDecl *F) {
----------------
Check `getAsCXXRecordDecl()` for null and add a test case.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone/standalone-empty.cpp:61
+
+int test_member_empty() {
+  std::vector<int> s;
----------------
I think you also need `no-warning` test cases when the empty() result is used.  


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128372



More information about the cfe-commits mailing list