From 7d7ee01e1d2fbe1095eb7fd7f1df065882982211 Mon Sep 17 00:00:00 2001
From: Argyrios Kyrtzidis <akyrtzi@gmail.com>
Date: Mon, 8 Dec 2014 08:48:27 +0000
Subject: [PATCH] [libclang] Encode C++11 rvalue reference types in the USR.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223631 91177308-0d34-0410-b5e6-96231b3b80d8
---
 lib/Index/USRGeneration.cpp | 5 +++++
 test/Index/usrs-cxx0x.cpp   | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/lib/Index/USRGeneration.cpp b/lib/Index/USRGeneration.cpp
index 88e6d3bf8ac..a41da8ae3e4 100644
--- a/lib/Index/USRGeneration.cpp
+++ b/lib/Index/USRGeneration.cpp
@@ -643,6 +643,11 @@ void USRGenerator::VisitType(QualType T) {
       T = PT->getPointeeType();
       continue;
     }
+    if (const RValueReferenceType *RT = T->getAs<RValueReferenceType>()) {
+      Out << "&&";
+      T = RT->getPointeeType();
+      continue;
+    }
     if (const ReferenceType *RT = T->getAs<ReferenceType>()) {
       Out << '&';
       T = RT->getPointeeType();
diff --git a/test/Index/usrs-cxx0x.cpp b/test/Index/usrs-cxx0x.cpp
index 822fed0cd28..6f28ebc5629 100644
--- a/test/Index/usrs-cxx0x.cpp
+++ b/test/Index/usrs-cxx0x.cpp
@@ -6,6 +6,7 @@ void f(tuple<int, float, double>);
 class TestCls {
   void meth() &;
   void meth() &&;
+  void meth(int&&);
 };
 
 // RUN: c-index-test -test-load-source-usrs all -std=c++11 %s | FileCheck %s
@@ -14,3 +15,4 @@ class TestCls {
 
 // CHECK: usrs-cxx0x.cpp c:@C@TestCls@F@meth#& Extent=[7:3 - 7:16]
 // CHECK: usrs-cxx0x.cpp c:@C@TestCls@F@meth#&& Extent=[8:3 - 8:17]
+// CHECK: usrs-cxx0x.cpp c:@C@TestCls@F@meth#&&I# Extent=[9:3 - 9:19]
-- 
GitLab