[PATCH] D31917: Add unique_dyn_cast
    Zachary Turner via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Apr 10 17:56:26 PDT 2017
    
    
  
zturner created this revision.
This addresses the issue pointed out in https://reviews.llvm.org/D31890 regarding a potentially confusing api for using `unique_ptr` in conjunction with `dyn_cast`.  It does so by implementing this not as a specialization / overload of `dyn_cast`, but as an entirely new function `unique_dyn_cast`.  Adding `unique` to the name makes clear through the API that the function will conditionally destroy the input if the cast succeeds, and leave the input alone if the cast fails.  A matching `unique_dyn_cast_or_null` is added as well.
https://reviews.llvm.org/D31917
Files:
  llvm/include/llvm/Support/Casting.h
  llvm/unittests/Support/Casting.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31917.94763.patch
Type: text/x-patch
Size: 4114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170411/411dc95b/attachment.bin>
    
    
More information about the llvm-commits
mailing list