[Patch] Make llvm::Regex non-copyable

Maciej Piechotka uzytkownik2 at gmail.com
Wed Jan 1 11:24:43 PST 2014


llvm_regfree is not a noop for the nullptr. I can move the check for
null there of course.

I'll update the patches with tests.

On Wed, 2014-01-01 at 19:15 +0000, dblaikie at gmail.com wrote:
> Some unit testing of the move ctor might be nice
> 
> Also - do you need the conditional in the dtor? delete nullptr; is a
> no-op, but I don't know if llvm_regfree is a safe no-op when the
> parameter is null.
> On Tue Dec 31 2013 at 9:27:10 AM, Maciej Piechotka
> <uzytkownik2 at gmail.com> wrote:
>         The current implementation of llvm::Regex does not support
>         copy
>         construction of it's values. However it is not enforced so
>         copying
>         llvm::Regex leads to crash (well - technically undefined
>         behaviour as
>         free'd memory is accessed and then freed once again).
>         
>         Attached patch makes llvm::Regex non-copyable but adds the
>         move
>         constructor for C++11.
>         
>         Best regards
>         _______________________________________________
>         llvm-commits mailing list
>         llvm-commits at cs.uiuc.edu
>         http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140101/2bb33f6a/attachment.sig>


More information about the llvm-commits mailing list