rjmccall added inline comments.

================
Comment at: include/clang/AST/Decl.h:3631
+    PassedIndirectly = true;
+  }
+
----------------
I feel like this flag should be set by Sema for C++ types that have to be 
passed indirectly as well; it can then become the single point of truth for 
that information.


================
Comment at: lib/CodeGen/CGNonTrivialStruct.cpp:764
+    Object = CGF->EmitObjCConsumeObject(QT, Object);
+    CGF->EmitARCStoreWeak(Addrs[DstIdx], Object, true);
+  }
----------------
I guess this is the most reasonable thing to do, given that we don't have an 
entrypoint for it.  Please ask the ObjC runtime team to consider giving us one, 
though.  We could pretty easily peephole assignments into `__weak` variables 
where the source is loaded from a `__weak` l-value / x-value, and Swift would 
probably be able to take advantage of it, too.

You might want to go ahead and add `emitARCCopyAssignWeak` / 
`emitARCMoveAssignWeak` methods on CGF that do these operations and which can 
be optimized to use those entrypoints if/when they're added.


================
Comment at: lib/CodeGen/TargetInfo.cpp:1326
+  if (RetTy.isPassedIndirectly() == QualType::APK_Struct)
+    return getNaturalAlignIndirect(RetTy);
+
----------------
Can we combine this into a single function that covers both the C++ case and 
this new one?  Otherwise it seems likely that individual targets over time will 
only add one or the other.


Repository:
  rC Clang

https://reviews.llvm.org/D44095



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to