[PATCH] D39308: [libcxx] Keep track of heap allocated regex states
    Marshall Clow via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Wed Oct 25 18:55:28 PDT 2017
    
    
  
mclow.lists added a comment.
A couple of notes.
- This change means that <regex> now requires C++11 (the new `__push` function w/ the varargs).  I don't know how important that is; but I'm pretty sure libc++ currently provides `<regex>` in C++03 mode.
- This is an ABI change; existing code that was compiled with the "old" `<regex>` implementation will not interoperate with this.
- I think that there may be some exception-safety issues in `__push`; if the `push_back` throws, I think we leak.
================
Comment at: libcxx/include/regex:4642
+{
+  auto __ret = new _NodeType(std::forward<_Args>(__args)...);
+  __storage_.__push(__ret);
----------------
Why `auto` here? 
How about `unique_ptr<_NodeType>` instead, and then
    __storage_.__push(__ret.get());
    return __ret.release()
https://reviews.llvm.org/D39308
    
    
More information about the cfe-commits
mailing list