[PATCH] D45384: [ObjC++] Never pass structs with `__weak` fields in registers

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 6 12:04:47 PDT 2018


ahatanak created this revision.
ahatanak added reviewers: rjmccall, rsmith.

This patch fixes a bug in r328731 that caused structs with `__weak` fields to be passed in registers. This happens when a struct doesn't have a `__weak` field but one of its subobjects does. To fix this, I added flag CXXRecordDecl::CannotPassInRegisters that propagates outwards and tracks whether a `__weak` field was seen. I added a new flag instead of reusing the CanPassInRegisters flag since in C++ we cannot always determine the value of a class' CanPassInRegisters flag by looking at its subobject's CanPassInRegisters flag (CanPassInRegisters=true in the subclass doesn't mean CanPassInRegisters=true in the derived class in C++).

rdar://problem/39194693


Repository:
  rC Clang

https://reviews.llvm.org/D45384

Files:
  include/clang/AST/DeclCXX.h
  lib/AST/ASTImporter.cpp
  lib/AST/DeclCXX.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriter.cpp
  test/CodeGenObjCXX/objc-struct-cxx-abi.mm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45384.141396.patch
Type: text/x-patch
Size: 7527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180406/4ed1e2de/attachment.bin>


More information about the cfe-commits mailing list