[clang] [clang] Handle trivial_abi attribute for Microsoft ABI. (PR #88857)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 18 15:15:31 PDT 2024


================
@@ -1105,6 +1105,11 @@ bool MicrosoftCXXABI::hasMostDerivedReturn(GlobalDecl GD) const {
 
 static bool isTrivialForMSVC(const CXXRecordDecl *RD, QualType Ty,
                              CodeGenModule &CGM) {
+  // If the record is marked with the trivial_abi attribute, we don't
+  // have to conform to the standard MSVC ABI.
+  if (RD->hasAttr<TrivialABIAttr>())
----------------
efriedma-quic wrote:

Oh, I see, whether the constructors/destructor/etc. are trivial for calls is determined recursively; we don't record whether that was because of an explicit trivial_abi attribute, or because there just weren't any non-trivial fields.  So we can't tell the difference here.

It feels sort of weird to treat a struct with a trivial_abi member as somehow more trivial than a struct that just contains plain data.

https://github.com/llvm/llvm-project/pull/88857


More information about the cfe-commits mailing list