[PATCH] D146194: NOT report the warning that unnamed bitfields are uninitialized.

Tang Wenyu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 16 06:54:36 PDT 2023


Tedlion accepted this revision.
Tedlion added a comment.

I argee that the different CSA behavior between C and C++ should be checked.

In D146194#4199257 <https://reviews.llvm.org/D146194#4199257>, @steakhal wrote:

> As per your proposed change, I think we should do something like this:
>
>   for (const auto *I : RD->fields()) {
>     if (I->isUnnamedBitfield())
>       continue;
>
> instead of embedding this into some condition.

Note in the begin and end of the for loop body, there is a push_back and pop_back action to FieldChain, that's why I have to emembed the new condition into the old. (OK now I know large diff context is necessary.)

  ...
        for (const auto *I : RD->fields()) {
          const FieldRegion *FR = MrMgr.getFieldRegion(I, R);
          FieldChain.push_back(I);    
          T = I->getType();
          if (T->getAsStructureType()) {
            if (Find(FR))
              return true;
          } else {
            const SVal &V = StoreMgr.getBinding(store, loc::MemRegionVal(FR));
            if (V.isUndef())
              return true;
          }
          FieldChain.pop_back();
        }
  
  ...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146194



More information about the cfe-commits mailing list