From 1d5e542fb22a9979a8634b6d3f130f77de2509be Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Mon, 8 Dec 2014 08:48:43 +0000 Subject: [PATCH] [libclang] Encode InjectedClassNameType in the USR. llvm-svn: 223634 --- clang/lib/Index/USRGeneration.cpp | 4 ++++ clang/test/Index/usrs.cpp | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/clang/lib/Index/USRGeneration.cpp b/clang/lib/Index/USRGeneration.cpp index 29a1b3d..d03d238 100644 --- a/clang/lib/Index/USRGeneration.cpp +++ b/clang/lib/Index/USRGeneration.cpp @@ -706,6 +706,10 @@ void USRGenerator::VisitType(QualType T) { Out << ':' << DNT->getIdentifier()->getName(); return; } + if (const InjectedClassNameType *InjT = T->getAs()) { + T = InjT->getInjectedSpecializationType(); + continue; + } // Unhandled type. Out << ' '; diff --git a/clang/test/Index/usrs.cpp b/clang/test/Index/usrs.cpp index 95d121d..3003fc5 100644 --- a/clang/test/Index/usrs.cpp +++ b/clang/test/Index/usrs.cpp @@ -90,6 +90,11 @@ void funWithChar(signed char c) {} struct { int x; } embedS1; struct { int x; } embedS2; +template +class TC1 { + void meth(TC1); +}; + // RUN: c-index-test -test-load-source-usrs all %s | FileCheck %s // CHECK: usrs.cpp c:@N@foo Extent=[1:1 - 4:2] // CHECK: usrs.cpp c:@N@foo@x Extent=[2:3 - 2:8] @@ -165,3 +170,5 @@ struct { int x; } embedS2; // CHECK: usrs.cpp c:usrs.cpp@S@usrs.cpp@1483@FI@x Extent=[90:10 - 90:15] // CHECK: usrs.cpp c:usrs.cpp@S@usrs.cpp@1510@FI@x Extent=[91:10 - 91:15] + +// CHECK: usrs.cpp c:@ST>1#T@TC1@F@meth#>@ST>1#T@TC11t0.0# Extent=[95:3 - 95:17] -- 2.7.4