aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-02-03 23:04:06 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-02-03 23:04:06 +0000
commitfd1e739a442b09a3f84eedfffda10b2263d76faa (patch)
tree5c84bb749b6375cbbf3040bbf663b5e553216633 /clang/lib/CodeGen/CodeGenFunction.h
parent2a96704b339699d60dd8849b4a73f4e133879354 (diff)
downloadllvm-fd1e739a442b09a3f84eedfffda10b2263d76faa.zip
llvm-fd1e739a442b09a3f84eedfffda10b2263d76faa.tar.gz
llvm-fd1e739a442b09a3f84eedfffda10b2263d76faa.tar.bz2
CodeGen: Copy-ctorm must obey the destination's alignment requirement
We would synthesize memcpy intrinsics when emitting calls to trivial C++ constructors but we wouldn't take into account the alignment of the destination. llvm-svn: 228061
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index ea63c84..03d2ab3 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -1559,6 +1559,15 @@ public:
true);
}
+ void EmitAggregateCopyCtor(llvm::Value *DestPtr, llvm::Value *SrcPtr,
+ QualType DestTy, QualType SrcTy) {
+ CharUnits DestTypeAlign = getContext().getTypeAlignInChars(DestTy);
+ CharUnits SrcTypeAlign = getContext().getTypeAlignInChars(SrcTy);
+ EmitAggregateCopy(DestPtr, SrcPtr, SrcTy, /*IsVolatile=*/false,
+ std::min(DestTypeAlign, SrcTypeAlign),
+ /*IsAssignment=*/false);
+ }
+
/// EmitAggregateCopy - Emit an aggregate copy.
///
/// \param isVolatile - True iff either the source or the destination is