[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:59:04 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:

> That's not how trivial_abi normally works?

I think it is how it works, based on re-reading the code just now and the test case I linked.

To your point, the MSVC-specific code in `canPassInRegisters` is full of bugs, but I don't want to ask @tru  to deal with that.

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


More information about the cfe-commits mailing list