[clang] [clang][analyzer] Ignore unnamed bitfields in UninitializedObjectChecker (PR #132427)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 25 05:39:33 PDT 2025
YLChenZ wrote:
My proposal is to judge the current `FieldDecl` at the beginning of the loop, and if it's a UnamedBitField, just skip it, because at that point the UnamedBitField's static check should be passing. If it's a NamedBitField then it needs to be initialized to pass the static check (i.e. go deeper to determine the type, value or whatever).
```cpp
for (const FieldDecl *I : RD->fields()) {
if (I->isUnnamedBitField()) { //my proposal
continue;
}
......
if (isPrimitiveType(T)) {
// Skip unnamed bitfields (padding)
if (I->isUnnamedBitField()) { //his proposal
continue;
}
......
}
}
```
The current test cases are sufficient. I'm not sure about the answers to the other questions.
https://github.com/llvm/llvm-project/pull/132427
More information about the cfe-commits
mailing list