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
You should definitely explain the semantic difference with CanPassInRegisters in this comment, and I think the field/method names should underline that. Maybe this is a place to pull out "Primitive" again?