r181237 - Have the RecursiveASTVisitor traverse the type source info of an objc class message.

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon May 6 12:08:57 PDT 2013


Author: akirtzidis
Date: Mon May  6 14:08:57 2013
New Revision: 181237

URL: http://llvm.org/viewvc/llvm-project?rev=181237&view=rev
Log:
Have the RecursiveASTVisitor traverse the type source info of an objc class message.

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

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=181237&r1=181236&r2=181237&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Mon May  6 14:08:57 2013
@@ -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, { })

Modified: cfe/trunk/test/Index/index-refs.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/index-refs.m?rev=181237&r1=181236&r2=181237&view=diff
==============================================================================
--- cfe/trunk/test/Index/index-refs.m (original)
+++ cfe/trunk/test/Index/index-refs.m Mon May  6 14:08:57 2013
@@ -13,6 +13,15 @@ void foo() {
   @encode(struct FooS);
 }
 
+ at interface I
++(void)clsMeth;
+ at 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

Modified: cfe/trunk/tools/libclang/IndexBody.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexBody.cpp?rev=181237&r1=181236&r2=181237&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexBody.cpp (original)
+++ cfe/trunk/tools/libclang/IndexBody.cpp Mon May  6 14:08:57 2013
@@ -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,

Modified: cfe/trunk/tools/libclang/RecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/RecursiveASTVisitor.h?rev=181237&r1=181236&r2=181237&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/RecursiveASTVisitor.h (original)
+++ cfe/trunk/tools/libclang/RecursiveASTVisitor.h Mon May  6 14:08:57 2013
@@ -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, { })





More information about the cfe-commits mailing list