This implements the [[msvc::no_unique_address]] attribute.
There is not ABI compatibility in this patch because the attribute is relatively new and there's still some uncertainty in the MSVC version.
Paths
| Differential D157762
Implement [[msvc::no_unique_address]] AbandonedPublic Authored by akhuang on Aug 11 2023, 3:27 PM.
Details
Summary This implements the [[msvc::no_unique_address]] attribute. There is not ABI compatibility in this patch because the attribute is relatively new and there's still some uncertainty in the MSVC version.
Diff Detail
Event Timelinedblaikie added inline comments.
Comment Actions Thank you for working on this! I had some comments, but I ran out of time before I could complete my review.
akhuang marked an inline comment as done. Comment ActionsAdd function to check for no_unique_address attributes Comment Actions still on vaca, but doing a drive-by.
Comment Actions I'm still trying to figure out the MSVC layouts. I used the EmptySubobjects class for a lot of the logic, which is not always the same as what MSVC does. (some examples of differences in https://godbolt.org/z/6cP554ddb) akhuang retitled this revision from [WIP] Implement [[msvc::no_unique_address]] to Implement [[msvc::no_unique_address]].Sep 6 2023, 3:51 PM Comment Actions turned this into a github PR https://github.com/llvm/llvm-project/pull/65675/commits/923a43cd6386f6e57023fd8928eed0dc0ab04d57
Revision Contents
Diff 549537 clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/lib/AST/Decl.cpp
clang/lib/AST/RecordLayoutBuilder.cpp
clang/lib/CodeGen/ABIInfoImpl.cpp
clang/lib/CodeGen/CGExprAgg.cpp
clang/lib/CodeGen/CGExprConstant.cpp
clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
clang/lib/Parse/ParseDeclCXX.cpp
clang/test/Layout/ms-no-unique-address.cpp
|
Hmmm, it would sure be nice if we could combine this attribute with NoUniqueAddress above and just have an accessor for whether it's the microsoft version or not... but I think the TargetSpecificAttr bit prevents us from doing that. CC @erichkeane in case he's got ideas.
(No changes needed currently, mostly just a cleanup question.)