]> granicus.if.org Git - clang/commitdiff
[index] In ObjC++ handle objc type parameters for function USRs.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 4 Mar 2016 07:17:43 +0000 (07:17 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 4 Mar 2016 07:17:43 +0000 (07:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262693 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Index/USRGeneration.cpp
test/Index/Core/index-source.mm [new file with mode: 0644]

index c15838c76c6310423287b6c866fde3ce0bca5510..85478265c061052d657931d7b541cbe7175bb63a 100644 (file)
@@ -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;
diff --git a/test/Index/Core/index-source.mm b/test/Index/Core/index-source.mm
new file mode 100644 (file)
index 0000000..049a0bd
--- /dev/null
@@ -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);