================ @@ -2852,8 +2852,21 @@ void CodeGenModule::ConstructAttributeList(StringRef Name, if (AI.getInReg()) Attrs.addAttribute(llvm::Attribute::InReg); - if (AI.getIndirectByVal()) + // Depending on the ABI, this may be either a byval or a dead_on_return + // argument. + if (AI.getIndirectByVal()) { Attrs.addByValAttr(getTypes().ConvertTypeForMem(ParamType)); + } else { + // Add dead_on_return when the object's lifetime ends in the callee. + // This includes trivially-destructible C++ objects, as well as objects + // whose destruction / clean-up is carried out within the callee (e.g., + // Obj-C++ ARC-managed structs, MSVC callee-destroyed objects). ---------------- antoniofrighetto wrote:
Oh, sure thing, thanks! https://github.com/llvm/llvm-project/pull/148159 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits