[clang] [Sema] Fix false positive warnings for misaligned member access (PR #150025)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 6 08:29:20 PDT 2025


================
@@ -15529,11 +15528,13 @@ void Sema::CheckArgumentWithTypeTag(const ArgumentWithTypeTagAttr *Attr,
 
 void Sema::AddPotentialMisalignedMembers(Expr *E, RecordDecl *RD, ValueDecl *MD,
                                          CharUnits Alignment) {
-  MisalignedMembers.emplace_back(E, RD, MD, Alignment);
+  currentEvaluationContext().MisalignedMembers.emplace_back(E, RD, MD,
+                                                            Alignment);
 }
 
 void Sema::DiagnoseMisalignedMembers() {
-  for (MisalignedMember &m : MisalignedMembers) {
+  auto &MisalignedMembersForExpr = currentEvaluationContext().MisalignedMembers;
----------------
erichkeane wrote:

Ah, hrmph.  Perhaps a name with `Cur` or something to help us figure that out?  That said, it is used only 2x, so i question the usefulness...

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


More information about the cfe-commits mailing list