[PATCH] D157332: [clang] Make init for empty no_unique_address fields a no-op write
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 7 22:46:37 PDT 2023
efriedma added a comment.
I see what you're getting at here... but I don't think this works quite right. If the empty class has a non-trivial constructor, we have to pass the correct "this" address to that constructor. Usually a constructor for an empty class won't do anything with that address, but it could theoretically do something with it.
In order to preserve the address in the cases we need it, we need a different invariant: the handling for each aggregate expression in EmitAggExpr needs to ensure it doesn't store anything to an empty class. Which is unfortunately more fragile than I'd like, but I can't think of a better approach. This check needs to happen further down the call stack. Maybe put it in CodeGenFunction::EmitCall.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157332/new/
https://reviews.llvm.org/D157332
More information about the cfe-commits
mailing list