diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-08-12 08:12:35 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-08-12 08:12:35 +0000 |
commit | 276222a5ae189ed5c6a2afb248d4c8f0335585b4 (patch) | |
tree | 091ab79822fefb238e55ea959e4c1a2c19f7e6cb /include/llvm/ADT/SmallVector.h | |
parent | 98147a306e9b3be6d52ad26f7836b89f46be99cb (diff) | |
download | llvm-276222a5ae189ed5c6a2afb248d4c8f0335585b4.tar.gz llvm-276222a5ae189ed5c6a2afb248d4c8f0335585b4.tar.bz2 llvm-276222a5ae189ed5c6a2afb248d4c8f0335585b4.tar.xz |
Change casts from old style to new style. This helps document the details
better, gives the compiler a chance to validate the cast and reduces warnings
if the user turns on -Wold-style-cast option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41033 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/SmallVector.h')
-rw-r--r-- | include/llvm/ADT/SmallVector.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/include/llvm/ADT/SmallVector.h b/include/llvm/ADT/SmallVector.h index e6c81a6420..dfb761699f 100644 --- a/include/llvm/ADT/SmallVector.h +++ b/include/llvm/ADT/SmallVector.h @@ -73,7 +73,9 @@ protected: public: // Default ctor - Initialize to empty. SmallVectorImpl(unsigned N) - : Begin((T*)&FirstEl), End((T*)&FirstEl), Capacity((T*)&FirstEl+N) { + : Begin(reinterpret_cast<T*>(&FirstEl)), + End(reinterpret_cast<T*>(&FirstEl)), + Capacity(reinterpret_cast<T*>(&FirstEl)+N) { } ~SmallVectorImpl() { @@ -82,7 +84,7 @@ public: // If this wasn't grown from the inline copy, deallocate the old space. if (!isSmall()) - delete[] (char*)Begin; + delete[] reinterpret_cast<char*>(Begin); } typedef size_t size_type; @@ -285,7 +287,8 @@ private: /// isSmall - Return true if this is a smallvector which has not had dynamic /// memory allocated for it. bool isSmall() const { - return (void*)Begin == (void*)&FirstEl; + return reinterpret_cast<const void*>(Begin) == + reinterpret_cast<const void*>(&FirstEl); } /// grow - double the size of the allocated memory, guaranteeing space for at @@ -323,7 +326,7 @@ void SmallVectorImpl<T>::grow(unsigned MinSize) { // If this wasn't grown from the inline copy, deallocate the old space. if (!isSmall()) - delete[] (char*)Begin; + delete[] reinterpret_cast<char*>(Begin); Begin = NewElts; End = NewElts+CurSize; |