================
@@ -15534,17 +15534,28 @@ void Sema::AddPotentialMisalignedMembers(Expr *E,
RecordDecl *RD, ValueDecl *MD,
MisalignedMembers.emplace_back(E, RD, MD, Alignment);
}
-void Sema::DiagnoseMisalignedMembers() {
- for (MisalignedMember &m : MisalignedMembers) {
- const NamedDecl *ND = m.RD;
+void Sema::DiagnoseMisalignedMembers(const Expr *E) {
+ // Only emit diagnostics related to the current expression.
+ const auto *EmitFrom = MisalignedMembers.begin();
+ if (E->getSourceRange().isValid()) {
----------------
vvuksanovic wrote:
The idea was to only emit diagnostics for candidates that are contained within
the expression that is currently being processed. The candidates that are
skipped here will get processed when the appropriate expr is completed, when
false positives related to that expr have been discarded.
I agree, we shouldn't rely on source locations for this. I'm working on a fix
that makes `MisalignedMembers` a stack similar to `ExprEvalContext` which will
be more reliable.
https://github.com/llvm/llvm-project/pull/150025
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits