Expose more properties of llvm::fltSemantics
[oota-llvm.git] / include / llvm / ADT / SmallVector.h
index b334ac0423a011a3eb21c1c32e15ad0759aed9e9..b9384702c3ba0588d3a402e677a9805d4c471729 100644 (file)
@@ -315,8 +315,10 @@ protected:
                                            T2>::value>::type * = nullptr) {
     // Use memcpy for PODs iterated by pointers (which includes SmallVector
     // iterators): std::uninitialized_copy optimizes to memmove, but we can
-    // use memcpy here.
-    memcpy(Dest, I, (E-I)*sizeof(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));
   }
 
   /// Double the size of the allocated memory, guaranteeing space for at
@@ -924,7 +926,7 @@ static inline size_t capacity_in_bytes(const SmallVector<T, N> &X) {
   return X.capacity_in_bytes();
 }
 
-} // namespace llvm
+} // End llvm namespace
 
 namespace std {
   /// Implement std::swap in terms of SmallVector swap.
@@ -940,6 +942,6 @@ namespace std {
   swap(llvm::SmallVector<T, N> &LHS, llvm::SmallVector<T, N> &RHS) {
     LHS.swap(RHS);
   }
-} // namespace std
+}
 
 #endif