[cfe-commits] r93947 - in /cfe/trunk: include/clang-c/Index.h tools/CIndex/CIndex.cpp tools/CIndex/CXCursor.cpp

Douglas Gregor dgregor at apple.com
Tue Jan 19 15:25:01 PST 2010


Author: dgregor
Date: Tue Jan 19 17:25:01 2010
New Revision: 93947

URL: http://llvm.org/viewvc/llvm-project?rev=93947&view=rev
Log:
Kill CXCursor_ObjCSelectorRef, CXCursor_VarRef, CXCursor_FunctionRef,
and CXCursor_EnumConstantRef; they've been subsumed by expression
references, which do a much nicer job.

Modified:
    cfe/trunk/include/clang-c/Index.h
    cfe/trunk/tools/CIndex/CIndex.cpp
    cfe/trunk/tools/CIndex/CXCursor.cpp

Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=93947&r1=93946&r2=93947&view=diff

==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Tue Jan 19 17:25:01 2010
@@ -113,12 +113,7 @@
  CXCursor_ObjCSuperClassRef             = 40,            
  CXCursor_ObjCProtocolRef               = 41,
  CXCursor_ObjCClassRef                  = 42,
- 
- CXCursor_ObjCSelectorRef               = 43, /* Expression references */
- CXCursor_VarRef                        = 44,
- CXCursor_FunctionRef                   = 45,
- CXCursor_EnumConstantRef               = 46,
- CXCursor_LastRef                       = 46,
+ CXCursor_LastRef                       = 42,
  
  /* Error conditions */
  CXCursor_FirstInvalid                  = 70,

Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=93947&r1=93946&r2=93947&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Tue Jan 19 17:25:01 2010
@@ -818,20 +818,6 @@
       assert(OID && "getCursorSpelling(): Missing protocol decl");
       return CIndexer::createCXString(OID->getIdentifier()->getNameStart());
     }
-    case CXCursor_ObjCSelectorRef: {
-      ObjCMessageExpr *OME = dyn_cast<ObjCMessageExpr>(getCursorStmt(C));
-      assert(OME && "getCursorSpelling(): Missing message expr");
-      return CIndexer::createCXString(OME->getSelector().getAsString().c_str(),
-                                      true);
-    }
-    case CXCursor_VarRef:
-    case CXCursor_FunctionRef:
-    case CXCursor_EnumConstantRef: {
-      DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(getCursorStmt(C));
-      assert(DRE && "getCursorSpelling(): Missing decl ref expr");
-      return CIndexer::createCXString(DRE->getDecl()->getIdentifier()
-                                      ->getNameStart());
-    }
     default:
       return CIndexer::createCXString("<not implemented>");
     }
@@ -872,10 +858,6 @@
   case CXCursor_ObjCSuperClassRef: return "ObjCSuperClassRef";
   case CXCursor_ObjCProtocolRef: return "ObjCProtocolRef";
   case CXCursor_ObjCClassRef: return "ObjCClassRef";
-  case CXCursor_ObjCSelectorRef: return "ObjCSelectorRef";
-  case CXCursor_VarRef: return "VarRef";
-  case CXCursor_FunctionRef: return "FunctionRef";
-  case CXCursor_EnumConstantRef: return "EnumConstantRef";
   case CXCursor_UnexposedExpr: return "UnexposedExpr";
   case CXCursor_DeclRefExpr: return "DeclRefExpr";
   case CXCursor_MemberRefExpr: return "MemberRefExpr";
@@ -1019,13 +1001,6 @@
       return translateSourceLocation(P.first->getASTContext(), P.second);
     }
       
-    case CXCursor_ObjCSelectorRef:
-    case CXCursor_VarRef:
-    case CXCursor_FunctionRef:
-    case CXCursor_EnumConstantRef:
-      return translateSourceLocation(getCursorContext(C), 
-                                     getLocationFromExpr(getCursorExpr(C)));
-        
     default:
       // FIXME: Need a way to enumerate all non-reference cases.
       llvm_unreachable("Missed a reference kind");
@@ -1070,13 +1045,6 @@
         return translateSourceRange(P.first->getASTContext(), P.second);
       }
         
-      case CXCursor_ObjCSelectorRef:
-      case CXCursor_VarRef:
-      case CXCursor_FunctionRef:
-      case CXCursor_EnumConstantRef:
-        return translateSourceRange(getCursorContext(C), 
-                                    getCursorExpr(C)->getSourceRange());
-        
       default:
         // FIXME: Need a way to enumerate all non-reference cases.
         llvm_unreachable("Missed a reference kind");
@@ -1120,16 +1088,6 @@
     case CXCursor_ObjCClassRef:      
       return MakeCXCursor(getCursorObjCClassRef(C).first);
       
-    case CXCursor_ObjCSelectorRef:
-    case CXCursor_VarRef:
-    case CXCursor_FunctionRef:
-    case CXCursor_EnumConstantRef: {
-      Decl *D = getDeclFromExpr(getCursorExpr(C));
-      if (D)
-        return MakeCXCursor(D);
-      break;
-    }
-      
     default:
       // We would prefer to enumerate all non-reference cursor kinds here.
       llvm_unreachable("Unhandled reference cursor kind");

Modified: cfe/trunk/tools/CIndex/CXCursor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CXCursor.cpp?rev=93947&r1=93946&r2=93947&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CXCursor.cpp (original)
+++ cfe/trunk/tools/CIndex/CXCursor.cpp Tue Jan 19 17:25:01 2010
@@ -306,12 +306,6 @@
   case CXCursor_ObjCClassRef:
     return static_cast<Decl *>(Cursor.data[0])->getASTContext();
     
-  case CXCursor_ObjCSelectorRef:
-  case CXCursor_VarRef:
-  case CXCursor_FunctionRef:
-  case CXCursor_EnumConstantRef:
-    return *static_cast<ASTContext *>(Cursor.data[2]);
-  
   case CXCursor_InvalidFile:
   case CXCursor_NoDeclFound:
   case CXCursor_NotImplemented:





More information about the cfe-commits mailing list