From f1249929c8a5d995a29f47221fee792e480b7ca5 Mon Sep 17 00:00:00 2001 From: John McCall Date: Tue, 21 Aug 2012 04:10:00 +0000 Subject: When performing a trivial copy of a C++ type, we must be careful not to overwrite objects that might have been allocated into the type's tail padding. This patch is missing some potential optimizations where the destination is provably a complete object, but it's necessary for correctness. Patch by Jonathan Sauer. llvm-svn: 162254 --- clang/lib/CodeGen/CGExprAgg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CGExprAgg.cpp') diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 61f7362ecaef..287b6dd8c7ca 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -1300,9 +1300,9 @@ void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr, // implementation handles this case safely. If there is a libc that does not // safely handle this, we can add a target hook. - // Get size and alignment info for this aggregate. + // Get data size and alignment info for this aggregate. std::pair TypeInfo = - getContext().getTypeInfoInChars(Ty); + getContext().getTypeInfoDataSizeInChars(Ty); if (alignment.isZero()) alignment = TypeInfo.second; -- cgit v1.2.3