llvm-project/clang/lib
Akira Hatanaka fcbe17c6be [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

llvm-svn: 328731
2018-03-28 21:13:14 +00:00
..
ARCMigrate Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-03 06:23:19 +00:00
AST [ObjC++] Make parameter passing and function return compatible with ObjC 2018-03-28 21:13:14 +00:00
ASTMatchers [clang] Change std::sort to llvm::sort in response to r327219 2018-03-27 16:50:00 +00:00
Analysis [clang] Change std::sort to llvm::sort in response to r327219 2018-03-27 16:50:00 +00:00
Basic [ObjC++] Make parameter passing and function return compatible with ObjC 2018-03-28 21:13:14 +00:00
CodeGen [ObjC++] Make parameter passing and function return compatible with ObjC 2018-03-28 21:13:14 +00:00
CrossTU [CrossTU] Fix handling of Cross Translation Unit directory path 2017-10-27 12:53:37 +00:00
Driver [PATCH] [RISCV] Verify the input value of -march= 2018-03-28 08:29:50 +00:00
Edit [Edit, Rewrite] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2018-03-27 00:01:49 +00:00
Format [clang] Change std::sort to llvm::sort in response to r327219 2018-03-27 16:50:00 +00:00
Frontend [ObjC++] Make parameter passing and function return compatible with ObjC 2018-03-28 21:13:14 +00:00
FrontendTool Make a build bot happy. 2018-02-10 14:26:53 +00:00
Headers [DOXYGEN] Fix doxygen and content issues in mmintrin.h 2018-03-09 00:38:51 +00:00
Index [Index] fix USR generation for namespace{extern{X}} 2018-02-02 14:13:37 +00:00
Lex Fix some handling of AST nodes with diagnostics. 2018-03-28 04:16:13 +00:00
Parse [OPENMP] Codegen for ctor|dtor of declare target variables. 2018-03-28 14:28:54 +00:00
Rewrite [Edit, Rewrite] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2018-03-27 00:01:49 +00:00
Sema [ObjC++] Make parameter passing and function return compatible with ObjC 2018-03-28 21:13:14 +00:00
Serialization [ObjC++] Make parameter passing and function return compatible with ObjC 2018-03-28 21:13:14 +00:00
StaticAnalyzer [clang] Change std::sort to llvm::sort in response to r327219 2018-03-27 16:50:00 +00:00
Tooling [clang] Change std::sort to llvm::sort in response to r327219 2018-03-27 16:50:00 +00:00
CMakeLists.txt Add Cross Translation Unit support library 2017-09-22 11:11:01 +00:00