r255875 - Add QualType case to operator< for DynTypedNode.
Richard Trieu via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 17 14:02:50 PST 2015
On Thu, Dec 17, 2015 at 5:47 AM, Aaron Ballman <aaron at aaronballman.com>
wrote:
> On Wed, Dec 16, 2015 at 11:46 PM, Richard Trieu via cfe-commits
> <cfe-commits at lists.llvm.org> wrote:
> > Author: rtrieu
> > Date: Wed Dec 16 22:46:48 2015
> > New Revision: 255875
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=255875&view=rev
> > Log:
> > Add QualType case to operator< for DynTypedNode.
> >
> > This allows sorting DynTypedNode's which are QualType's since QualType
> does
> > not have memoization.
> >
> > Modified:
> > cfe/trunk/include/clang/AST/ASTTypeTraits.h
> >
> > Modified: cfe/trunk/include/clang/AST/ASTTypeTraits.h
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTTypeTraits.h?rev=255875&r1=255874&r2=255875&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/include/clang/AST/ASTTypeTraits.h (original)
> > +++ cfe/trunk/include/clang/AST/ASTTypeTraits.h Wed Dec 16 22:46:48 2015
> > @@ -271,6 +271,10 @@ public:
> > if (!NodeKind.isSame(Other.NodeKind))
> > return NodeKind < Other.NodeKind;
> >
> > + if (ASTNodeKind::getFromNodeKind<QualType>().isSame(NodeKind))
> > + return getUnchecked<QualType>().getAsOpaquePtr() ==
> > + Other.getUnchecked<QualType>().getAsOpaquePtr();
> > +
>
> This only tests for equality, not comparison, which means operator< no
> longer has a strict weak ordering. Also, there are no tests for this
> change.
>
> ~Aaron
>
> r255929 changes the operator to '<', which should fix this. I don't have
a test case since the assertion was triggered in a recently checked in
Clang Tidy test that only fails in a special configuration that I couldn't
reproduce in a clean change.
> if (ASTNodeKind::getFromNodeKind<TypeLoc>().isSame(NodeKind)) {
> > auto TLA = getUnchecked<TypeLoc>();
> > auto TLB = Other.getUnchecked<TypeLoc>();
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151217/ac7e0968/attachment.html>
More information about the cfe-commits
mailing list