[PATCH] D50296: Fix few g++ 8 warning with non obvious copy object operations
David CARLIER via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 9 11:29:59 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL339367: Fix few g++ 8 warning with non obvious copy object operations (authored by devnexen, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D50296?vs=159180&id=159962#toc
Repository:
rL LLVM
https://reviews.llvm.org/D50296
Files:
llvm/trunk/include/llvm/ADT/DenseMap.h
llvm/trunk/include/llvm/ADT/SmallVector.h
Index: llvm/trunk/include/llvm/ADT/DenseMap.h
===================================================================
--- llvm/trunk/include/llvm/ADT/DenseMap.h
+++ llvm/trunk/include/llvm/ADT/DenseMap.h
@@ -393,7 +393,7 @@
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) {
Index: llvm/trunk/include/llvm/ADT/SmallVector.h
===================================================================
--- llvm/trunk/include/llvm/ADT/SmallVector.h
+++ llvm/trunk/include/llvm/ADT/SmallVector.h
@@ -299,7 +299,7 @@
// 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
@@ -310,7 +310,7 @@
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);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50296.159962.patch
Type: text/x-patch
Size: 1423 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180809/6c843c05/attachment.bin>
More information about the llvm-commits
mailing list