summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2018-03-28 21:13:14 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2018-03-28 21:13:14 +0000
commitc4bfd75d786a2a77c779cee6976534f37202ac21 (patch)
tree7d3c598ba8143ab5196aed15a7573593c53dabe5 /test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp
parent1ec33d54dfc07388c7bc7d637723ceeaa74869ee (diff)
[ObjC++] Make parameter passing and function return compatible with ObjC
ObjC and ObjC++ pass non-trivial structs in a way that is incompatible with each other. For example: typedef struct { id f0; __weak id f1; } S; // this code is compiled in c++. extern "C" { void foo(S s); } void caller() { // the caller passes the parameter indirectly and destructs it. foo(S()); } // this function is compiled in c. // 'a' is passed directly and is destructed in the callee. void foo(S a) { } This patch fixes the incompatibility by passing and returning structs with __strong or weak fields using the C ABI in C++ mode. __strong and __weak fields in a struct do not cause the struct to be destructed in the caller and __strong fields do not cause the struct to be passed indirectly. Also, this patch fixes the microsoft ABI bug mentioned here: https://reviews.llvm.org/D41039?id=128767#inline-364710 rdar://problem/38887866 Differential Revision: https://reviews.llvm.org/D44908 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328731 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp')
-rw-r--r--test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp3
1 files changed, 0 insertions, 3 deletions
diff --git a/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp b/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp
index f990c27426..36c9ca40db 100644
--- a/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp
+++ b/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp
@@ -172,12 +172,9 @@ void small_arg_with_dtor(SmallWithDtor s) {}
void call_small_arg_with_dtor() {
small_arg_with_dtor(SmallWithDtor());
}
-// The temporary is copied, so it's destroyed in the caller as well as the
-// callee.
// WIN64-LABEL: define dso_local void @"?call_small_arg_with_dtor@@YAXXZ"()
// WIN64: call %struct.SmallWithDtor* @"??0SmallWithDtor@@QEAA@XZ"
// WIN64: call void @"?small_arg_with_dtor@@YAXUSmallWithDtor@@@Z"(i32 %{{.*}})
-// WIN64: call void @"??1SmallWithDtor@@QEAA@XZ"
// WIN64: ret void
// Test that references aren't destroyed in the callee.