Remove 'default' case in switch statement in clang_getCursorKindSpelling(). This identified a missing case (warned by the compiler) and identified that CXCursor_FirstDecl didn't actually correspond to the first decl.

llvm-svn: 93622
This commit is contained in:
Ted Kremenek 2010-01-16 02:02:09 +00:00
parent 1e26ec35d7
commit 4ba5263441
2 changed files with 25 additions and 23 deletions

View File

@ -55,24 +55,24 @@ typedef void *CXStmt; /* A specific statement within a function/method */
enum CXCursorKind {
/* Declarations */
CXCursor_FirstDecl = 1,
CXCursor_TypedefDecl = 2,
CXCursor_StructDecl = 3,
CXCursor_UnionDecl = 4,
CXCursor_ClassDecl = 5,
CXCursor_EnumDecl = 6,
CXCursor_FieldDecl = 7,
CXCursor_EnumConstantDecl = 8,
CXCursor_FunctionDecl = 9,
CXCursor_VarDecl = 10,
CXCursor_ParmDecl = 11,
CXCursor_ObjCInterfaceDecl = 12,
CXCursor_ObjCCategoryDecl = 13,
CXCursor_ObjCProtocolDecl = 14,
CXCursor_ObjCPropertyDecl = 15,
CXCursor_ObjCIvarDecl = 16,
CXCursor_ObjCInstanceMethodDecl = 17,
CXCursor_ObjCClassMethodDecl = 18,
CXCursor_LastDecl = 18,
CXCursor_TypedefDecl = 1,
CXCursor_StructDecl = 2,
CXCursor_UnionDecl = 3,
CXCursor_ClassDecl = 4,
CXCursor_EnumDecl = 5,
CXCursor_FieldDecl = 6,
CXCursor_EnumConstantDecl = 7,
CXCursor_FunctionDecl = 8,
CXCursor_VarDecl = 9,
CXCursor_ParmDecl = 10,
CXCursor_ObjCInterfaceDecl = 11,
CXCursor_ObjCCategoryDecl = 12,
CXCursor_ObjCProtocolDecl = 13,
CXCursor_ObjCPropertyDecl = 14,
CXCursor_ObjCIvarDecl = 15,
CXCursor_ObjCInstanceMethodDecl = 16,
CXCursor_ObjCClassMethodDecl = 17,
CXCursor_LastDecl = 17,
/* Definitions */
CXCursor_FirstDefn = 32,

View File

@ -811,6 +811,7 @@ const char *clang_getCursorKindSpelling(enum CXCursorKind Kind) {
case CXCursor_UnionDecl: return "UnionDecl";
case CXCursor_ClassDecl: return "ClassDecl";
case CXCursor_FieldDecl: return "FieldDecl";
case CXCursor_FunctionDefn: return "FunctionDefn";
case CXCursor_VarDecl: return "VarDecl";
case CXCursor_ParmDecl: return "ParmDecl";
case CXCursor_ObjCInterfaceDecl: return "ObjCInterfaceDecl";
@ -818,13 +819,13 @@ const char *clang_getCursorKindSpelling(enum CXCursorKind Kind) {
case CXCursor_ObjCProtocolDecl: return "ObjCProtocolDecl";
case CXCursor_ObjCPropertyDecl: return "ObjCPropertyDecl";
case CXCursor_ObjCIvarDecl: return "ObjCIvarDecl";
case CXCursor_ObjCIvarRef: return "ObjCIvarRef";
case CXCursor_ObjCInstanceMethodDecl: return "ObjCInstanceMethodDecl";
case CXCursor_ObjCClassMethodDecl: return "ObjCClassMethodDecl";
case CXCursor_FunctionDefn: return "FunctionDefn";
case CXCursor_ObjCInstanceMethodDefn: return "ObjCInstanceMethodDefn";
case CXCursor_ObjCCategoryDefn: return "ObjCCategoryDefn";
case CXCursor_ObjCClassMethodDefn: return "ObjCClassMethodDefn";
case CXCursor_ObjCClassDefn: return "ObjCClassDefn";
case CXCursor_ObjCCategoryDefn: return "ObjCCategoryDefn";
case CXCursor_ObjCSuperClassRef: return "ObjCSuperClassRef";
case CXCursor_ObjCProtocolRef: return "ObjCProtocolRef";
case CXCursor_ObjCClassRef: return "ObjCClassRef";
@ -838,8 +839,10 @@ const char *clang_getCursorKindSpelling(enum CXCursorKind Kind) {
case CXCursor_InvalidFile: return "InvalidFile";
case CXCursor_NoDeclFound: return "NoDeclFound";
case CXCursor_NotImplemented: return "NotImplemented";
default: return "<not implemented>";
}
llvm_unreachable("Unhandled CXCursorKind");
return NULL;
}
CXCursor clang_getCursor(CXTranslationUnit CTUnit, const char *source_name,
@ -901,8 +904,7 @@ unsigned clang_equalCursors(CXCursor X, CXCursor Y) {
CXCursor clang_getCursorFromDecl(CXDecl AnonDecl) {
assert(AnonDecl && "Passed null CXDecl");
NamedDecl *ND = static_cast<NamedDecl *>(AnonDecl);
return MakeCXCursor(ND);
return MakeCXCursor(static_cast<NamedDecl *>(AnonDecl));
}
unsigned clang_isInvalid(enum CXCursorKind K) {