]> granicus.if.org Git - clang/commit
Fix a major swiftcall ABI bug with trivial C++ class types.
authorJohn McCall <rjmccall@apple.com>
Sun, 1 Apr 2018 21:04:30 +0000 (21:04 +0000)
committerJohn McCall <rjmccall@apple.com>
Sun, 1 Apr 2018 21:04:30 +0000 (21:04 +0000)
commit4448880e1818ce0dfffc0178be3a52bf5533be05
tree43cee328bba9cdc6d5cd7f0525ca2a34c1cdda0f
parent24879880b297dd86ac01f91b84340ecea90adf51
Fix a major swiftcall ABI bug with trivial C++ class types.

The problem with the previous logic was that there might not be any
explicit copy/move constructor declarations, e.g. if the type is
trivial and we've never type-checked a copy of it.  Relying on Sema's
computation seems much more reliable.

Also, I believe Richard's recommendation is exactly the rule we use
now on the Itanium ABI, modulo the trivial_abi attribute (which this
change of course fixes our handling of in Swift).

This does mean that we have a less portable rule for deciding
indirectness for swiftcall.  I would prefer it if we just applied the
Itanium rule universally under swiftcall, but in the meantime, I need
to fix this bug.

This only arises when defining functions with class-type arguments
in C++, as we do in the Swift runtime.  It doesn't affect normal Swift
operation because we don't import code as C++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328942 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SwiftCallingConv.cpp
test/CodeGenCXX/arm-swiftcall.cpp