[PATCH] D128372: [Clang-Tidy] Empty Check
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 3 13:45:48 PDT 2022
rsmith added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/StandaloneEmptyCheck.cpp:23
+#include "llvm/ADT/SmallVector.h"
+#include <clang/AST/Stmt.h>
+
----------------
================
Comment at: clang-tools-extra/clang-tidy/bugprone/StandaloneEmptyCheck.cpp:149
+ return;
+ CXXRecordDecl::method_range Methods = ArgRecordDecl->methods();
+ DeclContext::specific_decl_iterator<CXXMethodDecl> Clear =
----------------
This only looks for direct members, not ones found in a base class. Eg, this will not find `clear()` in `llvm::SmallVector<T, N>`. If you have a `Sema` object here, you could do a real name lookup; otherwise, you can use `CXXRecordDecl::lookupInBases` to do the lookup. You should be able to find some examples by searching for existing calls to that function.
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