[PATCH] D156337: [clang] Allow setting the uninitialized attribute on record
serge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 4 07:22:54 PDT 2023
serge-sans-paille added a comment.
In D156337#4558410 <https://reviews.llvm.org/D156337#4558410>, @aaron.ballman wrote:
> Was there an RFC for this extension to the attribute? (There doesn't need to be one, I'm just wondering if there's more background info on what's driving this patch forward and discussion around the design.)
>
> I'd like some more details about how this attribute impacts class hierarchies. e.g., if you put the attribute on the base class, does it impact the derived class members as well, or just the base class members? Also, what should happen in a case like this:
>
> template <typename Ty>
> void func() {
> Ty Val; // Does this know it's uninitialized? Or did we lose that information because this isn't a type attribute?
> }
>
> struct __attribute__((uninitialized)) S { int value; };
>
> int main() {
> func<S>();
> }
All very relevant topics. Concerning inheritance, I'd say that if the base class is marked as uninitialized and the child class is not, then base members are uninitialized and child members are not.
Concerning your example, I'd expect `Val` to be uninitialized as it's type has the according attribute, but I also don't quite understand "Or did we lose that information because this isn't a type attribute?"
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156337/new/
https://reviews.llvm.org/D156337
More information about the cfe-commits
mailing list