]> granicus.if.org Git - clang/commitdiff
Add QualType case to operator< for DynTypedNode.
authorRichard Trieu <rtrieu@google.com>
Thu, 17 Dec 2015 04:46:48 +0000 (04:46 +0000)
committerRichard Trieu <rtrieu@google.com>
Thu, 17 Dec 2015 04:46:48 +0000 (04:46 +0000)
This allows sorting DynTypedNode's which are QualType's since QualType does
not have memoization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255875 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/ASTTypeTraits.h

index 50ad9535a5105579364bb9f22ad41a917a9d3b36..a1aad0bd2a5af71ec9399441cb87a5cf7f077bee 100644 (file)
@@ -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>();