From: Rui Ueyama Date: Wed, 8 Apr 2015 21:13:23 +0000 (+0000) Subject: vec.data() and vec.data() + vec.size() are both safe even if the vector is empty. X-Git-Tag: llvmorg-3.7.0-rc1~7264 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5d6ff3d2eed7baf0e5fef4bea53102d09a3f49ba;p=platform%2Fupstream%2Fllvm.git vec.data() and vec.data() + vec.size() are both safe even if the vector is empty. llvm-svn: 234436 --- diff --git a/lld/include/lld/Core/File.h b/lld/include/lld/Core/File.h index cf95f5a..cfb58eb 100644 --- a/lld/include/lld/Core/File.h +++ b/lld/include/lld/Core/File.h @@ -199,14 +199,12 @@ protected: class atom_collection_vector : public atom_collection { public: atom_iterator begin() const override { - auto *it = _atoms.empty() ? nullptr - : reinterpret_cast(_atoms.data()); + const void *it = _atoms.data(); return atom_iterator(*this, it); } atom_iterator end() const override { - auto *it = _atoms.empty() ? nullptr : reinterpret_cast( - _atoms.data() + _atoms.size()); + const void *it = _atoms.data() + _atoms.size(); return atom_iterator(*this, it); }