[cfe-commits] r93622 - in /cfe/trunk: include/clang-c/Index.h tools/CIndex/CIndex.cpp
Ted Kremenek
kremenek at apple.com
Fri Jan 15 18:02:09 PST 2010
Author: kremenek
Date: Fri Jan 15 20:02:09 2010
New Revision: 93622
URL: http://llvm.org/viewvc/llvm-project?rev=93622&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/tools/CIndex/CIndex.cpp
Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=93622&r1=93621&r2=93622&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Fri Jan 15 20:02:09 2010
@@ -55,24 +55,24 @@
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,
Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=93622&r1=93621&r2=93622&view=diff
==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Fri Jan 15 20:02:09 2010
@@ -811,6 +811,7 @@
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 @@
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 @@
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 @@
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) {
More information about the cfe-commits
mailing list