Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
Fix few g++ 8 warning with non obvious copy object operations
Browse files Browse the repository at this point in the history
Reviewers: dblaikie, dexonsmith	

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D50296


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339367 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
devnexen committed Aug 9, 2018
1 parent 4afd04a commit 425788d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/llvm/ADT/DenseMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ class DenseMapBase : public DebugEpochBase {
setNumTombstones(other.getNumTombstones());

if (isPodLike<KeyT>::value && isPodLike<ValueT>::value)
memcpy(getBuckets(), other.getBuckets(),
memcpy(reinterpret_cast<void *>(getBuckets()), other.getBuckets(),
getNumBuckets() * sizeof(BucketT));
else
for (size_t i = 0; i < getNumBuckets(); ++i) {
Expand Down
4 changes: 2 additions & 2 deletions include/llvm/ADT/SmallVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class SmallVectorTemplateBase<T, true> : public SmallVectorTemplateCommon<T> {
// use memcpy here. Note that I and E are iterators and thus might be
// invalid for memcpy if they are equal.
if (I != E)
memcpy(Dest, I, (E - I) * sizeof(T));
memcpy(reinterpret_cast<void *>(Dest), I, (E - I) * sizeof(T));
}

/// Double the size of the allocated memory, guaranteeing space for at
Expand All @@ -310,7 +310,7 @@ class SmallVectorTemplateBase<T, true> : public SmallVectorTemplateCommon<T> {
void push_back(const T &Elt) {
if (LLVM_UNLIKELY(this->size() >= this->capacity()))
this->grow();
memcpy(this->end(), &Elt, sizeof(T));
memcpy(reinterpret_cast<void *>(this->end()), &Elt, sizeof(T));
this->set_size(this->size() + 1);
}

Expand Down

0 comments on commit 425788d

Please sign in to comment.