[CodeGen] Don't write into a SmallVector's uninitialized memory.

That's just ugly and not needed in this case. No functionality change.

llvm-svn: 243973
This commit is contained in:
Benjamin Kramer 2015-08-04 12:34:30 +00:00
parent 2ab0d88b91
commit 6c3e4ec449
1 changed files with 4 additions and 7 deletions

View File

@ -685,13 +685,10 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) {
// Copy the cleanup emission data out. Note that SmallVector // Copy the cleanup emission data out. Note that SmallVector
// guarantees maximal alignment for its buffer regardless of its // guarantees maximal alignment for its buffer regardless of its
// type parameter. // type parameter.
SmallVector<char, 8*sizeof(void*)> CleanupBuffer; auto *CleanupSource = reinterpret_cast<char *>(Scope.getCleanupBuffer());
CleanupBuffer.reserve(Scope.getCleanupSize()); SmallVector<char, 8 * sizeof(void *)> CleanupBuffer(
memcpy(CleanupBuffer.data(), CleanupSource, CleanupSource + Scope.getCleanupSize());
Scope.getCleanupBuffer(), Scope.getCleanupSize()); auto *Fn = reinterpret_cast<EHScopeStack::Cleanup *>(CleanupBuffer.data());
CleanupBuffer.set_size(Scope.getCleanupSize());
EHScopeStack::Cleanup *Fn =
reinterpret_cast<EHScopeStack::Cleanup*>(CleanupBuffer.data());
EHScopeStack::Cleanup::Flags cleanupFlags; EHScopeStack::Cleanup::Flags cleanupFlags;
if (Scope.isNormalCleanup()) if (Scope.isNormalCleanup())