diff options
author | Steve Naroff <snaroff@apple.com> | 2009-09-02 18:58:52 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-09-02 18:58:52 +0000 |
commit | b92c73a02a11231843e63d859f96c317a441d493 (patch) | |
tree | 28d76450ea841bc42e03b4c730224de7dcd2b50d | |
parent | 80a766bf50f08e4921e88aae073ed29e26419b61 (diff) | |
download | bcm5719-llvm-b92c73a02a11231843e63d859f96c317a441d493.tar.gz bcm5719-llvm-b92c73a02a11231843e63d859f96c317a441d493.zip |
Fix some newly added bugs uncovered by the RELEASE build.
llvm-svn: 80813
-rw-r--r-- | clang/tools/CIndex/CIndex.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp index f2af27cd65a..82f7fb8e2b6 100644 --- a/clang/tools/CIndex/CIndex.cpp +++ b/clang/tools/CIndex/CIndex.cpp @@ -253,10 +253,12 @@ const char *clang_getCursorSpelling(CXCursor C) if (clang_isReference(C.kind)) { switch (C.kind) { - case CXCursor_ObjCSuperClassRef: + case CXCursor_ObjCSuperClassRef: + { ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(ND); assert(OID && "clang_getCursorLine(): Missing interface decl"); return OID->getSuperClass()->getIdentifier()->getName(); + } default: return "<not implemented>"; } @@ -326,24 +328,23 @@ unsigned clang_isDefinition(enum CXCursorKind K) static SourceLocation getLocationFromCursor(CXCursor C, SourceManager &SourceMgr, NamedDecl *ND) { - SourceLocation SLoc; if (clang_isReference(C.kind)) { switch (C.kind) { case CXCursor_ObjCSuperClassRef: + { ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(ND); assert(OID && "clang_getCursorLine(): Missing interface decl"); - SLoc = OID->getSuperClassLoc(); - break; + return OID->getSuperClassLoc(); + } default: - break; + return SourceLocation(); } } else { // We have a declaration or a definition. - SLoc = ND->getLocation(); + SourceLocation SLoc = ND->getLocation(); if (SLoc.isInvalid()) return SourceLocation(); - SLoc = SourceMgr.getSpellingLoc(SLoc); // handles macro instantiations. + return SourceMgr.getSpellingLoc(SLoc); // handles macro instantiations. } - return SLoc; } unsigned clang_getCursorLine(CXCursor C) |