[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 07:19:40 PDT 2023


Tedlion updated this revision to Diff 505802.
Tedlion edited the summary of this revision.
Tedlion added a comment.

Provide the full diff context instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146194

Files:
  clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp


Index: clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
@@ -262,7 +262,9 @@
         if (T->getAsStructureType()) {
           if (Find(FR))
             return true;
-        } else {
+        } else if (!I->isUnnamedBitfield()){
+          // unnamed bitfields are skipped during aggregate initialization
+          // Since they are not supposed to be used, warnings should not be reported
           const SVal &V = StoreMgr.getBinding(store, loc::MemRegionVal(FR));
           if (V.isUndef())
             return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146194.505802.patch
Type: text/x-patch
Size: 732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230316/7cd9f9e2/attachment.bin>


More information about the cfe-commits mailing list