[clang] Add an off-by-default warning to complain about MSVC bitfield padding (PR #117428)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 8 23:14:50 PST 2025


================
@@ -19240,6 +19240,25 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl,
 
     if (Record && FD->getType().isVolatileQualified())
       Record->setHasVolatileMember(true);
+    auto IsNonDependentBitField = [](const FieldDecl *FD) {
+      return FD->isBitField() && !FD->getType()->isDependentType();
+    };
+
+    if (Record && PreviousField && IsNonDependentBitField(FD) &&
----------------
cor3ntin wrote:

If this is not enabled by default, maybe we should check the diagnostic is not ignored to avoid unnecessary work (`DiagnosticsEngine::isIgnored`)

https://github.com/llvm/llvm-project/pull/117428


More information about the cfe-commits mailing list