r255875 - Add QualType case to operator< for DynTypedNode.

Richard Trieu via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 16 20:46:49 PST 2015


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();
+
     if (ASTNodeKind::getFromNodeKind<TypeLoc>().isSame(NodeKind)) {
       auto TLA = getUnchecked<TypeLoc>();
       auto TLB = Other.getUnchecked<TypeLoc>();




More information about the cfe-commits mailing list