]> granicus.if.org Git - clang/commitdiff
Have the RecursiveASTVisitor traverse the type source info of an objc class message.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 6 May 2013 19:08:57 +0000 (19:08 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 6 May 2013 19:08:57 +0000 (19:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181237 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/RecursiveASTVisitor.h
test/Index/index-refs.m
tools/libclang/IndexBody.cpp
tools/libclang/RecursiveASTVisitor.h

index eb5a8123c29cf0de2406682e66a76a88e873f8a1..b5a4b5e36d7d068701c0fd158ea5c237a7da8079 100644 (file)
@@ -2195,7 +2195,10 @@ DEF_TRAVERSE_STMT(ObjCEncodeExpr, {
 })
 DEF_TRAVERSE_STMT(ObjCIsaExpr, { })
 DEF_TRAVERSE_STMT(ObjCIvarRefExpr, { })
-DEF_TRAVERSE_STMT(ObjCMessageExpr, { })
+DEF_TRAVERSE_STMT(ObjCMessageExpr, {
+  if (TypeSourceInfo *TInfo = S->getClassReceiverTypeInfo())
+    TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
+})
 DEF_TRAVERSE_STMT(ObjCPropertyRefExpr, { })
 DEF_TRAVERSE_STMT(ObjCSubscriptRefExpr, { })
 DEF_TRAVERSE_STMT(ObjCProtocolExpr, { })
index b82345f9c685e922c285b851e148a36d342a49e4..f25013b882f6e914dc6978dbd9e55a155e1d9d5a 100644 (file)
@@ -13,6 +13,15 @@ void foo() {
   @encode(struct FooS);
 }
 
+@interface I
++(void)clsMeth;
+@end
+
+void foo2() {
+  [I clsMeth];
+}
+
 // RUN: c-index-test -index-file %s | FileCheck %s
 // CHECK: [indexEntityReference]: kind: objc-protocol | name: Prot | {{.*}} | loc: 12:27
 // CHECK: [indexEntityReference]: kind: struct | name: FooS | {{.*}} | loc: 13:18
+// CHECK: [indexEntityReference]: kind: objc-class | name: I | {{.*}} | loc: 21:4
index 54711e6332ab051b0c177c1e9e26acbd3a9e3800..02ab885e62f0d93cc83fd8f3ad1fa59bfd016038 100644 (file)
@@ -68,9 +68,6 @@ public:
   }
 
   bool VisitObjCMessageExpr(ObjCMessageExpr *E) {
-    if (TypeSourceInfo *Cls = E->getClassReceiverTypeInfo())
-      IndexCtx.indexTypeSourceInfo(Cls, Parent, ParentDC);
-
     if (ObjCMethodDecl *MD = E->getMethodDecl())
       IndexCtx.handleReference(MD, E->getSelectorStartLoc(),
                                Parent, ParentDC, E,
index dd2c836d9cf3d28d8f404198e03ebe4c9c56af81..e45545ed1ad2698b26c7ec98eb75d7e71061df8a 100644 (file)
@@ -2116,7 +2116,10 @@ DEF_TRAVERSE_STMT(ObjCEncodeExpr, {
 })
 DEF_TRAVERSE_STMT(ObjCIsaExpr, { })
 DEF_TRAVERSE_STMT(ObjCIvarRefExpr, { })
-DEF_TRAVERSE_STMT(ObjCMessageExpr, { })
+DEF_TRAVERSE_STMT(ObjCMessageExpr, {
+  if (TypeSourceInfo *TInfo = S->getClassReceiverTypeInfo())
+    TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
+})
 DEF_TRAVERSE_STMT(ObjCPropertyRefExpr, { })
 DEF_TRAVERSE_STMT(ObjCSubscriptRefExpr, { })
 DEF_TRAVERSE_STMT(ObjCProtocolExpr, { })