[PATCH] D122341: Fix a crash with variably-modified parameter types in a naked function
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 24 04:49:37 PDT 2022
aaron.ballman added a comment.
In D122341#3403587 <https://reviews.llvm.org/D122341#3403587>, @erichkeane wrote:
> Other than this 1 thing, LGTM. I DO find myself wondering how much of the CXXMethodDecl bit in the branch above is valid for 'naked' as well. If it ISN'T we might consider moving this loop AND that to EmitFunctionPrologue.
There's a different kind of bug there. MSVC disallows using the `naked` attribute on a member function. Clang doesn't enforce this: https://godbolt.org/z/6jKGbzYTq GCC has no such restriction, but GCC doesn't have many diagnostics in this area anyway. We may want to reconsider whether allowing the naked attribute on a non static member function is a good idea. We probably don't want to allow it in MS compatibility mode at the very least. But I think this can be a change for another day. WDYT?
================
Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:1200
+ if (!FD || !FD->hasAttr<NakedAttr>()) {
+ for (FunctionArgList::const_iterator i = Args.begin(), e = Args.end();
+ i != e; ++i) {
----------------
erichkeane wrote:
> Since you're touching it... this looks like a 'range-for' loop :D
Sure, I can do that.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122341/new/
https://reviews.llvm.org/D122341
More information about the cfe-commits
mailing list