[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 06:22:29 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:

What is the point of the reference here?  I'm not sure I get its purpose?  Is it just to shorten the name for the 2 uses?

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


More information about the cfe-commits mailing list