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 | 1164d859c7828d3856f17e43da323332a5e3920e (patch) | |
tree | ba6de47db251387e6b87c37629858b58d904489d | |
parent | f334b4e3eda5a39f041fe13f805dbb53535daa2f (diff) |
Fix some newly added bugs uncovered by the RELEASE build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80813 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/CIndex/CIndex.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp index f2af27cd65..82f7fb8e2b 100644 --- a/tools/CIndex/CIndex.cpp +++ b/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) |