[PATCH] D84992: [clang codegen] Use IR "align" attribute for static array arguments.
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 10 12:48:41 PDT 2020
efriedma added inline comments.
================
Comment at: clang/lib/CodeGen/CGCall.cpp:2503
+ llvm::Align Alignment =
+ CGM.getNaturalTypeAlignment(ETy).getAsAlign();
+ AI->addAttrs(llvm::AttrBuilder().addAlignmentAttr(Alignment));
----------------
rjmccall wrote:
> Is it reasonable to assume that this is an array of complete objects, or do we need to worry about someone doing e.g.
>
> ```
> class A : virtual HighlyAligned { char buffer[16]; ];
>
> void foo(A[static 1]);
> ```
>
> This isn't completely disabled in C++ mode, is it?
It is disabled in C++: "error: static array size is a C99 feature, not permitted in C++",
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84992/new/
https://reviews.llvm.org/D84992
More information about the cfe-commits
mailing list