[ObjC] Allow declaring __weak pointer fields in C structs in ARC.

This patch uses the infrastructure added in r326307 for enabling
non-trivial fields to be declared in C structs to allow __weak fields in
C structs in ARC.

This recommits r327206, which was reverted because it caused
module-enabled builders to fail. I discovered that the
CXXRecordDecl::CanPassInRegisters flag wasn't being set correctly in
some cases after I moved it to RecordDecl.

Thanks to Eric Liu for helping me investigate the bug.

rdar://problem/33599681

https://reviews.llvm.org/D44095

llvm-svn: 327870
diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map
index 4788daa..93fe468 100644
--- a/clang/test/Modules/Inputs/module.map
+++ b/clang/test/Modules/Inputs/module.map
@@ -460,3 +460,13 @@
    header "innerstructredef.h"
   }
 }
+
+module template_nontrivial0 {
+  header "template-nontrivial0.h"
+  export *
+}
+
+module template_nontrivial1 {
+  header "template-nontrivial1.h"
+  export *
+}
diff --git a/clang/test/Modules/Inputs/template-nontrivial0.h b/clang/test/Modules/Inputs/template-nontrivial0.h
new file mode 100644
index 0000000..cff080e
--- /dev/null
+++ b/clang/test/Modules/Inputs/template-nontrivial0.h
@@ -0,0 +1,13 @@
+template <class T>
+struct Class0 {
+  Class0();
+  Class0(const Class0<T> &);
+  ~Class0();
+  T *p;
+};
+
+struct S0 {
+  id x;
+};
+
+Class0<S0> returnNonTrivial();
diff --git a/clang/test/Modules/Inputs/template-nontrivial1.h b/clang/test/Modules/Inputs/template-nontrivial1.h
new file mode 100644
index 0000000..24136f0
--- /dev/null
+++ b/clang/test/Modules/Inputs/template-nontrivial1.h
@@ -0,0 +1,6 @@
+@import template_nontrivial0;
+
+struct S1 {
+  S1();
+  Class0<S0> a;
+};