[PATCH] D122271: [Clang] -Wunused-but-set-variable warning - handle also pre/post unary operators

Kamau Bridgeman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 25 07:55:52 PDT 2022


kamaub added a comment.

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.


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