[PATCH] D118350: [Clang][Sema][AIX][PowerPC] Emit byval alignment warning only when struct member is passed to a function
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 8 07:58:34 PST 2022
aaron.ballman added a comment.
Thanks! I think we're pretty close, just some wording nits with the diagnostics.
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:3299-3301
+ : Warning<" %0 byte requested alignment for a struct member used as an"
+ " argument is 16 bytes or greater which is not binary"
+ " compatible with IBM XL C/C++ for AIX 16.1.0 or older">,
How about this slight rewording from the old form? (Have to re-flow to 80 cols.)
I had previously suggested adding the requested alignment before but now that we're closely tying the diagnostic to the structure member, I think this form is okay (and it's shorter, which is what I was hoping to accomplish).
Comment at: clang/lib/Sema/SemaChecking.cpp:5221
+ << (unsigned)Alignment.getQuantity() << FD;
+ Diag(Loc, diag::note_called_by) << FD->getDeclName();
I don't think this note is the correct one to use (it looks weird in the test cases). I think you'll want to add a new note along the lines of:
def note_misaligned_member_used_here : Note<
"%0 used with potentially incompatible alignment here">;
And you should pass in `FD` rather than `FD->getDeclName()` (the diagnostics engine knows how to print the names of `NamedDecl` subclasses and has special logic for that.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the cfe-commits