[PATCH] D12354: [libcxx] Add global assertion handler for debug mode.

Duncan P. N. Exon Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 21 21:35:41 PST 2016


> On 2016-Jan-21, at 17:59, Eric Fiselier <eric at efcs.ca> wrote:
> 
> EricWF added a comment.
> 
> In http://reviews.llvm.org/D12354#331776, @dexonsmith wrote:
> 
>> This patch looks correct to me.  Is there any reason it wasn't committed?
> 
> 
> I was concerned about using a function-local static in the library headers, I don't think libc++ does that anywhere else and I wanted to make sure it was safe to do.
> 
> 
> http://reviews.llvm.org/D12354

Ah, in the testing hook.  I feel like it's better than the current
situation, anyway.  Unless we have ABI guarantees for _LIBCPP_DEBUG
since this could lock us in somehow.  (Do we?  Should we?)

Thinking through a couple of other options:

 2. The test could provide its own version of _LIBCPP_ASSERT.  It's
    not obvious how to hook into the assertions in src/debug.cpp
    though.

 3. We could move __debug_assert() and __debug_assertion_handler()
    to the dylib (and use a static global variable there).

Maybe (3) is the best.  Is it important for these functions to be
inline, given that they're in the slow path anyway?


More information about the cfe-commits mailing list