From 084236fafd6e3916de2d5970340a9f88a5f2b042 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 19 Jan 2010 23:25:01 +0000 Subject: [PATCH] Kill CXCursor_ObjCSelectorRef, CXCursor_VarRef, CXCursor_FunctionRef, and CXCursor_EnumConstantRef; they've been subsumed by expression references, which do a much nicer job. llvm-svn: 93947 --- clang/include/clang-c/Index.h | 7 +----- clang/tools/CIndex/CIndex.cpp | 42 --------------------------------- clang/tools/CIndex/CXCursor.cpp | 6 ----- 3 files changed, 1 insertion(+), 54 deletions(-) diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index 8a2ff8822e62..1abf6490e7c1 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -113,12 +113,7 @@ enum CXCursorKind { 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, diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp index 00169e2af1f9..032dd126f690 100644 --- a/clang/tools/CIndex/CIndex.cpp +++ b/clang/tools/CIndex/CIndex.cpp @@ -818,20 +818,6 @@ CXString clang_getCursorSpelling(CXCursor C) { assert(OID && "getCursorSpelling(): Missing protocol decl"); return CIndexer::createCXString(OID->getIdentifier()->getNameStart()); } - case CXCursor_ObjCSelectorRef: { - ObjCMessageExpr *OME = dyn_cast(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(getCursorStmt(C)); - assert(DRE && "getCursorSpelling(): Missing decl ref expr"); - return CIndexer::createCXString(DRE->getDecl()->getIdentifier() - ->getNameStart()); - } default: return CIndexer::createCXString(""); } @@ -872,10 +858,6 @@ const char *clang_getCursorKindSpelling(enum CXCursorKind Kind) { 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 @@ CXSourceLocation clang_getCursorLocation(CXCursor C) { 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 @@ CXSourceRange clang_getCursorExtent(CXCursor C) { 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 @@ CXCursor clang_getCursorReferenced(CXCursor C) { 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"); diff --git a/clang/tools/CIndex/CXCursor.cpp b/clang/tools/CIndex/CXCursor.cpp index 68fba7e3cd7e..f13e2eea89f5 100644 --- a/clang/tools/CIndex/CXCursor.cpp +++ b/clang/tools/CIndex/CXCursor.cpp @@ -306,12 +306,6 @@ ASTContext &cxcursor::getCursorContext(CXCursor Cursor) { case CXCursor_ObjCClassRef: return static_cast(Cursor.data[0])->getASTContext(); - case CXCursor_ObjCSelectorRef: - case CXCursor_VarRef: - case CXCursor_FunctionRef: - case CXCursor_EnumConstantRef: - return *static_cast(Cursor.data[2]); - case CXCursor_InvalidFile: case CXCursor_NoDeclFound: case CXCursor_NotImplemented: