[cfe-commits] [libcxx] r139933 - in /libcxx/trunk: include/__debug include/iterator src/debug.cpp

Steven Watanabe watanabesj at gmail.com
Fri Sep 16 13:43:49 PDT 2011


AMDG

On 09/16/2011 12:52 PM, Howard Hinnant wrote:
> Author: hhinnant
> Date: Fri Sep 16 14:52:23 2011
> New Revision: 139933
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=139933&view=rev
> Log:
> Doug Gregor pointed out some problems with debug mode enabled in one TU and not another.  This patch helps detect those situations and offers improved error messages to help get debug mode enabled in more TU's when it is absolutely necessary to do so.  Thanks Doug.
> 

Okay, so this handles cases where the container/iterator is
constructed without debug information, and used with it.
What about when a container is constructed with debug
information, and destroyed without it?  Will the dangling
pointer in the database cause any problems other than the
obvious memory leak?

> 
>      __i_node* i = __find_iterator(__i);
> -    return i != nullptr ? (i->__c_ != nullptr ? i->__c_->__c_ : nullptr) : nullptr;
> +    _LIBCPP_ASSERT(i != nullptr, "iterator constructed in translation unit with debug mode not enabled."
> +                   "  #define _LIBCPP_DEBUG2 1 for that translation unit.");
> +    return i->__c_ != nullptr ? i->__c_->__c_ : nullptr;
>  }
>  <snip>
> 

In Christ,
Steven Watanabe

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110916/0a5aca9e/attachment.sig>


More information about the cfe-commits mailing list