diff options
author | Louis Dionne <ldionne@apple.com> | 2019-10-01 21:28:20 +0300 |
---|---|---|
committer | Louis Dionne <ldionne@apple.com> | 2019-10-01 21:28:20 +0300 |
commit | 2cee0e2d97c4f6fcb6cfcadf0e449f5ed714a72c (patch) | |
tree | fb2efc79d5fbcbad438da93ab047919d3dcde0e0 /libcxxabi/src/cxa_vector.cpp | |
parent | 856c1cd8520cde316f4e96572afdb45e0f60647b (diff) |
[NFC][libc++abi] Remove trailing whitespace from sources
llvm-svn: 373379
Diffstat (limited to 'libcxxabi/src/cxa_vector.cpp')
-rw-r--r-- | libcxxabi/src/cxa_vector.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/libcxxabi/src/cxa_vector.cpp b/libcxxabi/src/cxa_vector.cpp index 3237b1df523d..cc358f05e005 100644 --- a/libcxxabi/src/cxa_vector.cpp +++ b/libcxxabi/src/cxa_vector.cpp @@ -4,10 +4,10 @@ // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// +// // This file implements the "Array Construction and Destruction APIs" // https://itanium-cxx-abi.github.io/cxx-abi/abi.html#array-ctor -// +// //===----------------------------------------------------------------------===// #include "cxxabi.h" @@ -51,27 +51,27 @@ namespace { class st_heap_block2 { public: typedef void (*dealloc_f)(void *); - - st_heap_block2 ( dealloc_f dealloc, void *ptr ) + + st_heap_block2 ( dealloc_f dealloc, void *ptr ) : dealloc_ ( dealloc ), ptr_ ( ptr ), enabled_ ( true ) {} ~st_heap_block2 () { if ( enabled_ ) dealloc_ ( ptr_ ) ; } void release () { enabled_ = false; } - + private: dealloc_f dealloc_; void *ptr_; bool enabled_; }; - + class st_heap_block3 { public: typedef void (*dealloc_f)(void *, size_t); - - st_heap_block3 ( dealloc_f dealloc, void *ptr, size_t size ) + + st_heap_block3 ( dealloc_f dealloc, void *ptr, size_t size ) : dealloc_ ( dealloc ), ptr_ ( ptr ), size_ ( size ), enabled_ ( true ) {} ~st_heap_block3 () { if ( enabled_ ) dealloc_ ( ptr_, size_ ) ; } void release () { enabled_ = false; } - + private: dealloc_f dealloc_; void *ptr_; @@ -82,17 +82,17 @@ namespace { class st_cxa_cleanup { public: typedef void (*destruct_f)(void *); - + st_cxa_cleanup ( void *ptr, size_t &idx, size_t element_size, destruct_f destructor ) - : ptr_ ( ptr ), idx_ ( idx ), element_size_ ( element_size ), + : ptr_ ( ptr ), idx_ ( idx ), element_size_ ( element_size ), destructor_ ( destructor ), enabled_ ( true ) {} ~st_cxa_cleanup () { - if ( enabled_ ) + if ( enabled_ ) __cxa_vec_cleanup ( ptr_, idx_, element_size_, destructor_ ); } - + void release () { enabled_ = false; } - + private: void *ptr_; size_t &idx_; @@ -100,7 +100,7 @@ namespace { destruct_f destructor_; bool enabled_; }; - + class st_terminate { public: st_terminate ( bool enabled = true ) : enabled_ ( enabled ) {} @@ -164,13 +164,13 @@ size_t calculate_allocation_size_or_throw(size_t element_count, extern "C" { // Equivalent to -// +// // __cxa_vec_new2(element_count, element_size, padding_size, constructor, // destructor, &::operator new[], &::operator delete[]) _LIBCXXABI_FUNC_VIS void * __cxa_vec_new(size_t element_count, size_t element_size, size_t padding_size, void (*constructor)(void *), void (*destructor)(void *)) { - return __cxa_vec_new2 ( element_count, element_size, padding_size, + return __cxa_vec_new2 ( element_count, element_size, padding_size, constructor, destructor, &::operator new [], &::operator delete [] ); } @@ -180,16 +180,16 @@ __cxa_vec_new(size_t element_count, size_t element_size, size_t padding_size, // the array preceded by the specified padding, initialize the cookie if // the padding is non-zero, and call the given constructor on each element. // Return the address of the array proper, after the padding. -// +// // If alloc throws an exception, rethrow the exception. If alloc returns // NULL, return NULL. If the constructor throws an exception, call // destructor for any already constructed elements, and rethrow the // exception. If the destructor throws an exception, call std::terminate. -// +// // The constructor may be NULL, in which case it must not be called. If the // padding_size is zero, the destructor may be NULL; in that case it must // not be called. -// +// // Neither alloc nor dealloc may be NULL. _LIBCXXABI_FUNC_VIS void * __cxa_vec_new2(size_t element_count, size_t element_size, size_t padding_size, @@ -208,12 +208,12 @@ __cxa_vec_new2(size_t element_count, size_t element_size, size_t padding_size, vec_base += padding_size; __set_element_count ( vec_base, element_count ); } - + // Construct the elements __cxa_vec_ctor ( vec_base, element_count, element_size, constructor, destructor ); heap.release (); // We're good! } - + return vec_base; } @@ -237,16 +237,16 @@ __cxa_vec_new3(size_t element_count, size_t element_size, size_t padding_size, vec_base += padding_size; __set_element_count ( vec_base, element_count ); } - + // Construct the elements __cxa_vec_ctor ( vec_base, element_count, element_size, constructor, destructor ); heap.release (); // We're good! } - + return vec_base; } - - + + // Given the (data) addresses of a destination and a source array, an // element count and an element size, call the given copy constructor to // copy each element from the source array to the destination array. The @@ -266,9 +266,9 @@ _LIBCXXABI_FUNC_VIS void __cxa_vec_cctor(void *dest_array, void *src_array, size_t idx = 0; char *src_ptr = static_cast<char *>(src_array); char *dest_ptr = static_cast<char *>(dest_array); - st_cxa_cleanup cleanup ( dest_array, idx, element_size, destructor ); + st_cxa_cleanup cleanup ( dest_array, idx, element_size, destructor ); - for ( idx = 0; idx < element_count; + for ( idx = 0; idx < element_count; ++idx, src_ptr += element_size, dest_ptr += element_size ) constructor ( dest_ptr, src_ptr ); cleanup.release (); // We're good! @@ -289,8 +289,8 @@ __cxa_vec_ctor(void *array_address, size_t element_count, size_t element_size, if ( NULL != constructor ) { size_t idx; char *ptr = static_cast <char *> ( array_address ); - st_cxa_cleanup cleanup ( array_address, idx, element_size, destructor ); - + st_cxa_cleanup cleanup ( array_address, idx, element_size, destructor ); + // Construct the elements for ( idx = 0; idx < element_count; ++idx, ptr += element_size ) constructor ( ptr ); @@ -311,7 +311,7 @@ _LIBCXXABI_FUNC_VIS void __cxa_vec_dtor(void *array_address, if ( NULL != destructor ) { char *ptr = static_cast <char *> (array_address); size_t idx = element_count; - st_cxa_cleanup cleanup ( array_address, idx, element_size, destructor ); + st_cxa_cleanup cleanup ( array_address, idx, element_size, destructor ); { st_terminate exception_guard (__cxa_uncaught_exception ()); ptr += element_count * element_size; // one past the last element @@ -338,7 +338,7 @@ _LIBCXXABI_FUNC_VIS void __cxa_vec_cleanup(void *array_address, char *ptr = static_cast <char *> (array_address); size_t idx = element_count; st_terminate exception_guard; - + ptr += element_count * element_size; // one past the last element while ( idx-- > 0 ) { ptr -= element_size; @@ -359,7 +359,7 @@ _LIBCXXABI_FUNC_VIS void __cxa_vec_cleanup(void *array_address, // throws a second exception, call terminate(). If padding_size is 0, the // destructor pointer must be NULL. If the destructor pointer is NULL, no // destructor call is to be made. -// +// // The intent of this function is to permit an implementation to call this // function when confronted with an expression of the form delete[] p in // the source code, provided that the default deallocation function can be @@ -387,9 +387,9 @@ __cxa_vec_delete2(void *array_address, size_t element_size, size_t padding_size, char *vec_base = static_cast <char *> (array_address); char *heap_block = vec_base - padding_size; st_heap_block2 heap ( dealloc, heap_block ); - + if ( 0 != padding_size && NULL != destructor ) // call the destructors - __cxa_vec_dtor ( array_address, __get_element_count ( vec_base ), + __cxa_vec_dtor ( array_address, __get_element_count ( vec_base ), element_size, destructor ); } } |