[PATCH] D122271: [Clang] -Wunused-but-set-variable warning - handle also pre/post unary operators
Dávid Bolvanský via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 25 09:08:44 PDT 2022
xbolva00 added a comment.
In D122271#3408060 <https://reviews.llvm.org/D122271#3408060>, @kamaub wrote:
> This option appears to incorrectly warn warning that `unsigned NumEntries = getNumEntries();` is "set but not used" in llvm/include/llvm/ADT/DenseMap.h:129 <https://lab.llvm.org/buildbot/#/builders/36/builds/19279/steps/12/logs/stdio> and so it is breaking the ppc64le-lld-multistage-test <https://lab.llvm.org/buildbot/#/builders/36> bot.
> This could be because the only use is in an assert which is in a corner case maybe?
>
> const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey();
> if (std::is_trivially_destructible<ValueT>::value) {
> // Use a simpler loop when values don't need destruction.
> for (BucketT *P = getBuckets(), *E = getBucketsEnd(); P != E; ++P)
> P->getFirst() = EmptyKey;
> } else {
> unsigned NumEntries = getNumEntries();
> for (BucketT *P = getBuckets(), *E = getBucketsEnd(); P != E; ++P) {
> if (!KeyInfoT::isEqual(P->getFirst(), EmptyKey)) {
> if (!KeyInfoT::isEqual(P->getFirst(), TombstoneKey)) {
> P->getSecond().~ValueT();
> --NumEntries;
> }
> P->getFirst() = EmptyKey;
> }
> }
> assert(NumEntries == 0 && "Node count imbalance!");
> }
>
> I noticed you were commit NFCI changes to makes sure you did not break any builds before reapplying but it appears you missed llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp:3924 <https://lab.llvm.org/buildbot/#/builders/18/builds/4347/steps/15/logs/stdio> which is causing build breaks to both the sanitizer-ppc64be-linux <https://lab.llvm.org/buildbot/#/builders/18> and sanitizer-ppc64le-linux <https://lab.llvm.org/buildbot/#/builders/19> bots. Is there an NFCI planned for it by you? If not I'll submit an NFC change myself in a few minutes.
>> This option appears to incorrectly warn warning that
Warns correctly in configurations where assert is removed. (void) trick will solve that.
Sorry, I missed this one, as this was outside common code + X86. Will push fix soon.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122271/new/
https://reviews.llvm.org/D122271
More information about the cfe-commits
mailing list