[cfe-commits] Fwd: Compare two DeclGroupRefs

Vassil Vassilev vasil.georgiev.vasilev at cern.ch
Fri Jul 20 04:44:53 PDT 2012


Hi Sean,
   Thanks for your comments!

On 07/18/2012 11:32 PM, Sean Silva wrote:
> Why not
>
> std::equal(LHS.begin(), LHS.end(), RHS.begin(), RHS.end())
>
> ?
>
   Yes I can use std::equal, however I don't think I can gain much.
> You may also want factor in if they are the same "kind" of 
> DeclGroupRef (i.e. isSingleDecl vs. isDeclGroup). Once you have that, 
> then just compare appropriately.
>
  I am actually comparing the "kind" of the DeclGroupRefs: see the part 
isSingleDecl().
> I'm not sure exactly how best to define the equality on DeclGroupRefs. 
> One possibility is "they represent the same sequence of Decl*'s", in 
> which case, the std::equal solution should be correct (maybe needing 
> an isNull() check).
I am not sure either :) I think it makes sense to compare the sequences 
of the Decl* and the Decl*'s kinds. I am attaching the new patch.
>
> --Sean Silva
Vassil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120720/b694f72c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-include-ast-declgroup.diff
Type: text/x-patch
Size: 2650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120720/b694f72c/attachment.bin>


More information about the cfe-commits mailing list