Author: akirtzidis Date: Fri Mar 4 01:17:43 2016 New Revision: 262693 URL: http://llvm.org/viewvc/llvm-project?rev=262693&view=rev Log: [index] In ObjC++ handle objc type parameters for function USRs.
Added: cfe/trunk/test/Index/Core/index-source.mm Modified: cfe/trunk/lib/Index/USRGeneration.cpp Modified: cfe/trunk/lib/Index/USRGeneration.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/USRGeneration.cpp?rev=262693&r1=262692&r2=262693&view=diff ============================================================================== --- cfe/trunk/lib/Index/USRGeneration.cpp (original) +++ cfe/trunk/lib/Index/USRGeneration.cpp Fri Mar 4 01:17:43 2016 @@ -663,6 +663,11 @@ void USRGenerator::VisitType(QualType T) T = PT->getPointeeType(); continue; } + if (const ObjCObjectPointerType *OPT = T->getAs<ObjCObjectPointerType>()) { + Out << '*'; + T = OPT->getPointeeType(); + continue; + } if (const RValueReferenceType *RT = T->getAs<RValueReferenceType>()) { Out << "&&"; T = RT->getPointeeType(); @@ -697,6 +702,18 @@ void USRGenerator::VisitType(QualType T) VisitTagDecl(TT->getDecl()); return; } + if (const ObjCInterfaceType *OIT = T->getAs<ObjCInterfaceType>()) { + Out << '$'; + VisitObjCInterfaceDecl(OIT->getDecl()); + return; + } + if (const ObjCObjectType *OIT = T->getAs<ObjCObjectType>()) { + Out << 'Q'; + VisitType(OIT->getBaseType()); + for (auto *Prot : OIT->getProtocols()) + VisitObjCProtocolDecl(Prot); + return; + } if (const TemplateTypeParmType *TTP = T->getAs<TemplateTypeParmType>()) { Out << 't' << TTP->getDepth() << '.' << TTP->getIndex(); return; Added: cfe/trunk/test/Index/Core/index-source.mm URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Core/index-source.mm?rev=262693&view=auto ============================================================================== --- cfe/trunk/test/Index/Core/index-source.mm (added) +++ cfe/trunk/test/Index/Core/index-source.mm Fri Mar 4 01:17:43 2016 @@ -0,0 +1,11 @@ +// RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s + +@interface MyCls +@end + +@protocol P1,P2; + +// CHECK: [[@LINE+1]]:6 | function/C | foo | c:@F@foo#*$objc(cs)MyCls# | __Z3fooP5MyCls | Decl | rel: 0 +void foo(MyCls *o); +// CHECK: [[@LINE+1]]:6 | function/C | foo | c:@F@foo#*Qoobjc(pl)P1objc(pl)P2# | __Z3fooPU15objcproto2P12P211objc_object | Decl | rel: 0 +void foo(id<P2, P1> o); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits