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

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 18 14:09:09 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>())
----------------
rnk wrote:

I've realized this misses a case, consider this a wrapper struct that contains a trivial_abi subobject: https://godbolt.org/z/bK6aGv4d7

I spent 15 minutes looking through the things we track for trivial_abi, and unfortunately, we don't track this anywhere already, so the best solution I can come up with is to do a recursive walk of all the subobjects and look for the attribute. :(

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


More information about the cfe-commits mailing list