From 70a7cf9c33c5b3b64e08a9965104bb4efd9bd383 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Tue, 1 Oct 2019 18:28:20 +0000 Subject: [NFC][libc++abi] Remove trailing whitespace from sources git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@373379 91177308-0d34-0410-b5e6-96231b3b80d8 --- src/cxa_exception.cpp | 42 +++++++++++++------------- src/cxa_exception.h | 4 +-- src/cxa_exception_storage.cpp | 10 +++---- src/cxa_noexception.cpp | 4 +-- src/cxa_personality.cpp | 42 +++++++++++++------------- src/cxa_vector.cpp | 70 +++++++++++++++++++++---------------------- 6 files changed, 86 insertions(+), 86 deletions(-) diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp index 688ba1e..7d56c42 100644 --- a/src/cxa_exception.cpp +++ b/src/cxa_exception.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 "Exception Handling APIs" // https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html -// +// //===----------------------------------------------------------------------===// #include "cxxabi.h" @@ -81,7 +81,7 @@ size_t cxa_exception_size_from_exception_thrown_size(size_t size) { void __setExceptionClass(_Unwind_Exception* unwind_exception, uint64_t newValue) { ::memcpy(&unwind_exception->exception_class, &newValue, sizeof(newValue)); } - + static void setOurExceptionClass(_Unwind_Exception* unwind_exception) { __setExceptionClass(unwind_exception, kOurExceptionClass); @@ -103,7 +103,7 @@ uint64_t __getExceptionClass(const _Unwind_Exception* unwind_exception) { } bool __isOurExceptionClass(const _Unwind_Exception* unwind_exception) { - return (__getExceptionClass(unwind_exception) & get_vendor_and_language) == + return (__getExceptionClass(unwind_exception) & get_vendor_and_language) == (kOurExceptionClass & get_vendor_and_language); } @@ -123,7 +123,7 @@ static inline int decrementHandlerCount(__cxa_exception *exception) { /* If reason isn't _URC_FOREIGN_EXCEPTION_CAUGHT, then the terminateHandler - stored in exc is called. Otherwise the exceptionDestructor stored in + stored in exc is called. Otherwise the exceptionDestructor stored in exc is called, and then the memory for the exception is deallocated. This is never called for a __cxa_dependent_exception. @@ -145,7 +145,7 @@ static _LIBCXXABI_NORETURN void failed_throw(__cxa_exception* exception_header) // * For purposes of this ABI, several things are considered exception handlers: // ** A terminate() call due to a throw. // and -// * Upon entry, Following initialization of the catch parameter, +// * Upon entry, Following initialization of the catch parameter, // a handler must call: // * void *__cxa_begin_catch(void *exceptionObject ); (void) __cxa_begin_catch(&exception_header->unwindHeader); @@ -237,15 +237,15 @@ routine never returns. The __cxa_throw routine will do the following: * Obtain the __cxa_exception header from the thrown exception object address, -which can be computed as follows: - __cxa_exception *header = ((__cxa_exception *) thrown_exception - 1); +which can be computed as follows: + __cxa_exception *header = ((__cxa_exception *) thrown_exception - 1); * Save the current unexpected_handler and terminate_handler in the __cxa_exception header. -* Save the tinfo and dest arguments in the __cxa_exception header. +* Save the tinfo and dest arguments in the __cxa_exception header. * Set the exception_class field in the unwind header. This is a 64-bit value representing the ASCII string "XXXXC++\0", where "XXXX" is a vendor-dependent string. That is, for implementations conforming to this ABI, the low-order 4 bytes of this 64-bit value will be "C++\0". -* Increment the uncaught_exception flag. +* Increment the uncaught_exception flag. * Call _Unwind_RaiseException in the system unwind library, Its argument is the pointer to the thrown exception, which __cxa_throw itself received as an argument. __Unwind_RaiseException begins the process of stack unwinding, described @@ -386,7 +386,7 @@ asm ( " .popsection" ); #endif // defined(_LIBCXXABI_ARM_EHABI) - + /* This routine can catch foreign or native exceptions. If native, the exception can be a primary or dependent variety. This routine may remain blissfully @@ -394,7 +394,7 @@ ignorant of whether the native exception is primary or dependent. If the exception is native: * Increment's the exception's handler count. -* Push the exception on the stack of currently-caught exceptions if it is not +* Push the exception on the stack of currently-caught exceptions if it is not already there (from a rethrow). * Decrements the uncaught_exception count. * Returns the adjusted pointer to the exception object, which is stored in @@ -415,7 +415,7 @@ to terminate or unexpected during unwinding. doesn't. It has a stack of __cxa_exception (which has a next* in it). * Do not decrement the uncaught_exception count because we didn't increment it in __cxa_throw (or one of our rethrow functions). -* If we haven't terminated, assume the exception object is just past the +* If we haven't terminated, assume the exception object is just past the _Unwind_Exception and return a pointer to that. */ void* @@ -539,7 +539,7 @@ void __cxa_end_catch() { __cxa_decrement_exception_refcount(thrown_object_from_cxa_exception(exception_header)); } } - } + } else { // The foreign exception has not been rethrown. Pop the stack @@ -572,10 +572,10 @@ std::type_info *__cxa_current_exception_type() { // 2.5.4 Rethrowing Exceptions /* This routine can rethrow native or foreign exceptions. If the exception is native: -* marks the exception object on top of the caughtExceptions stack - (in an implementation-defined way) as being rethrown. -* If the caughtExceptions stack is empty, it calls terminate() - (see [C++FDIS] [except.throw], 15.1.8). +* marks the exception object on top of the caughtExceptions stack + (in an implementation-defined way) as being rethrown. +* If the caughtExceptions stack is empty, it calls terminate() + (see [C++FDIS] [except.throw], 15.1.8). * It then calls _Unwind_RaiseException which should not return (terminate if it does). Note: exception_header may be masquerading as a __cxa_dependent_exception @@ -609,7 +609,7 @@ void __cxa_rethrow() { #endif // If we get here, some kind of unwinding error has occurred. - // There is some weird code generation bug happening with + // There is some weird code generation bug happening with // Apple clang version 4.0 (tags/Apple/clang-418.0.2) (based on LLVM 3.1svn) // If we call failed_throw here. Turns up with -O2 or higher, and -Os. __cxa_begin_catch(&exception_header->unwindHeader); @@ -664,7 +664,7 @@ void __cxa_decrement_exception_refcount(void *thrown_object) throw() { returns null. We can use __cxa_get_globals_fast here to get the globals because if there have - been no exceptions thrown, ever, on this thread, we can return NULL without + been no exceptions thrown, ever, on this thread, we can return NULL without the need to allocate the exception-handling globals. */ void *__cxa_current_primary_exception() throw() { @@ -697,7 +697,7 @@ static void dependent_exception_cleanup(_Unwind_Reason_Code reason, _Unwind_Exception* unwind_exception) { - __cxa_dependent_exception* dep_exception_header = + __cxa_dependent_exception* dep_exception_header = reinterpret_cast<__cxa_dependent_exception*>(unwind_exception + 1) - 1; if (_URC_FOREIGN_EXCEPTION_CAUGHT != reason) std::__terminate(dep_exception_header->terminateHandler); diff --git a/src/cxa_exception.h b/src/cxa_exception.h index d24b80a..d7999e0 100644 --- a/src/cxa_exception.h +++ b/src/cxa_exception.h @@ -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 "Exception Handling APIs" // https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html -// +// //===----------------------------------------------------------------------===// #ifndef _CXA_EXCEPTION_H diff --git a/src/cxa_exception_storage.cpp b/src/cxa_exception_storage.cpp index dea6702..28c0122 100644 --- a/src/cxa_exception_storage.cpp +++ b/src/cxa_exception_storage.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 storage for the "Caught Exception Stack" // https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html#cxx-exc-stack -// +// //===----------------------------------------------------------------------===// #include "cxa_exception.h" @@ -69,13 +69,13 @@ namespace { if ( 0 != std::__libcpp_tls_create ( &key_, destruct_ ) ) abort_message("cannot create thread specific key for __cxa_get_globals()"); } -} +} extern "C" { __cxa_eh_globals * __cxa_get_globals () { // Try to get the globals for this thread __cxa_eh_globals* retVal = __cxa_get_globals_fast (); - + // If this is the first time we've been asked for these globals, create them if ( NULL == retVal ) { retVal = static_cast<__cxa_eh_globals*> @@ -99,7 +99,7 @@ extern "C" { // static int init = construct_(); return static_cast<__cxa_eh_globals*>(std::__libcpp_tls_get(key_)); } - + } } #endif diff --git a/src/cxa_noexception.cpp b/src/cxa_noexception.cpp index 2182c70..73e0b2a 100644 --- a/src/cxa_noexception.cpp +++ b/src/cxa_noexception.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 "Exception Handling APIs" // https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html -// +// //===----------------------------------------------------------------------===// // Support functions for the no-exceptions libc++ library diff --git a/src/cxa_personality.cpp b/src/cxa_personality.cpp index f140b74..f276257 100644 --- a/src/cxa_personality.cpp +++ b/src/cxa_personality.cpp @@ -4,11 +4,11 @@ // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// +// // This file implements the "Exception Handling APIs" // https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html // http://www.intel.com/design/itanium/downloads/245358.htm -// +// //===----------------------------------------------------------------------===// #include @@ -188,8 +188,8 @@ enum DW_EH_PE_omit = 0xFF }; -/// Read a uleb128 encoded value and advance pointer -/// See Variable Length Data Appendix C in: +/// Read a uleb128 encoded value and advance pointer +/// See Variable Length Data Appendix C in: /// @link http://dwarfstd.org/Dwarf4.pdf @unlink /// @param data reference variable holding memory pointer to decode from /// @returns decoded value @@ -211,8 +211,8 @@ readULEB128(const uint8_t** data) return result; } -/// Read a sleb128 encoded value and advance pointer -/// See Variable Length Data Appendix C in: +/// Read a sleb128 encoded value and advance pointer +/// See Variable Length Data Appendix C in: /// @link http://dwarfstd.org/Dwarf4.pdf @unlink /// @param data reference variable holding memory pointer to decode from /// @returns decoded value @@ -236,8 +236,8 @@ readSLEB128(const uint8_t** data) return static_cast(result); } -/// Read a pointer encoded value and advance pointer -/// See Variable Length Data in: +/// Read a pointer encoded value and advance pointer +/// See Variable Length Data in: /// @link http://dwarfstd.org/Dwarf3.pdf @unlink /// @param data reference variable holding memory pointer to decode from /// @param encoding dwarf encoding type @@ -247,10 +247,10 @@ uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding) { uintptr_t result = 0; - if (encoding == DW_EH_PE_omit) + if (encoding == DW_EH_PE_omit) return result; const uint8_t* p = *data; - // first get value + // first get value switch (encoding & 0x0F) { case DW_EH_PE_absptr: @@ -281,15 +281,15 @@ readEncodedPointer(const uint8_t** data, uint8_t encoding) result = readPointerHelper(p); break; default: - // not supported + // not supported abort(); break; } - // then add relative offset + // then add relative offset switch (encoding & 0x70) { case DW_EH_PE_absptr: - // do nothing + // do nothing break; case DW_EH_PE_pcrel: if (result) @@ -300,11 +300,11 @@ readEncodedPointer(const uint8_t** data, uint8_t encoding) case DW_EH_PE_funcrel: case DW_EH_PE_aligned: default: - // not supported + // not supported abort(); break; } - // then apply indirection + // then apply indirection if (result && (encoding & DW_EH_PE_indirect)) result = *((uintptr_t*)result); *data = p; @@ -613,7 +613,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, // Get the current instruction pointer and offset it before next // instruction in the current frame which threw the exception. uintptr_t ip = _Unwind_GetIP(context) - 1; - // Get beginning current frame's code (as defined by the + // Get beginning current frame's code (as defined by the // emitted dwarf code) uintptr_t funcStart = _Unwind_GetRegionStart(context); #ifdef __USING_SJLJ_EXCEPTIONS__ @@ -646,8 +646,8 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, uintptr_t classInfoOffset = readULEB128(&lsda); classInfo = lsda + classInfoOffset; } - // Walk call-site table looking for range that - // includes current PC. + // Walk call-site table looking for range that + // includes current PC. uint8_t callSiteEncoding = *lsda++; #ifdef __USING_SJLJ_EXCEPTIONS__ (void)callSiteEncoding; // When using SjLj exceptions, callSiteEncoding is never used @@ -928,13 +928,13 @@ _UA_CLEANUP_PHASE else Recover state from header Transfer control to landing pad. return _URC_INSTALL_CONTEXT - + Else This branch handles both normal C++ non-catching handlers (cleanups) - and forced unwinding. + and forced unwinding. Scan for anything that can not stop unwinding: - + 1. A cleanup. If a cleanup is found diff --git a/src/cxa_vector.cpp b/src/cxa_vector.cpp index 3237b1d..cc358f0 100644 --- a/src/cxa_vector.cpp +++ b/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(src_array); char *dest_ptr = static_cast(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 ( 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 (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 (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 (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 ); } } -- cgit v1.2.3