[PATCH] D128372: [Clang-Tidy] Empty Check
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 1 15:34:51 PST 2022
MaskRay added a comment.
I just took a glance and the code looks reasonable.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/StandaloneEmptyCheck.cpp:131
+ bool HasClear = !Candidates.empty();
+
+ if (HasClear) {
----------------
delete blank line
================
Comment at: clang-tools-extra/clang-tidy/bugprone/StandaloneEmptyCheck.cpp:160
+ const Expr *Arg = NonMemberCall->getArg(0);
+
+ CXXRecordDecl *ArgRecordDecl = Arg->getType()->getAsCXXRecordDecl();
----------------
delete blank line
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone/standalone-empty.cpp:161
+ std::vector<int> v;
+
+ v.empty();
----------------
unneeded blank line
ditto below
They just make tests less compact without good values.
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone/standalone-empty.cpp:177
+ v.empty();
+ // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: ignoring the result of 'empty()'; did you mean 'clear()'? [bugprone-standalone-empty]
+ // CHECK-FIXES: {{^ }} v.clear();{{$}}
----------------
`[[@LINE-1]]` is deprecated lit syntax. Use `[[#@LINE-1]]`. Don't use the prevailing style in clang-tidy tests.
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