diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-16 15:44:18 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-16 15:44:18 +0000 |
commit | ef6eb84da15e7894edcc0bae08161c5016d76f44 (patch) | |
tree | 1c3d81ed35b5df31ba2befe004cca13ad041e54c /clang/tools/CIndex/CXCursor.cpp | |
parent | 002b67105500e620d5f87693f981a8abd0afb32b (diff) | |
download | bcm5719-llvm-ef6eb84da15e7894edcc0bae08161c5016d76f44.tar.gz bcm5719-llvm-ef6eb84da15e7894edcc0bae08161c5016d76f44.zip |
Use a sane encoding for CXCursor_ObjCProtocolRef, using the actual
source locations where the protocols were referenced rather than the
location of some random enclosing declaration.
llvm-svn: 93637
Diffstat (limited to 'clang/tools/CIndex/CXCursor.cpp')
-rw-r--r-- | clang/tools/CIndex/CXCursor.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/clang/tools/CIndex/CXCursor.cpp b/clang/tools/CIndex/CXCursor.cpp index d6c38673e01..01d809a8db8 100644 --- a/clang/tools/CIndex/CXCursor.cpp +++ b/clang/tools/CIndex/CXCursor.cpp @@ -90,6 +90,21 @@ cxcursor::getCursorObjCSuperClassRef(CXCursor C) { reinterpret_cast<uintptr_t>(C.data[1]))); } +CXCursor cxcursor::MakeCursorObjCProtocolRef(ObjCProtocolDecl *Super, + SourceLocation Loc) { + void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding()); + CXCursor C = { CXCursor_ObjCProtocolRef, { Super, RawLoc, 0 } }; + return C; +} + +std::pair<ObjCProtocolDecl *, SourceLocation> +cxcursor::getCursorObjCProtocolRef(CXCursor C) { + assert(C.kind == CXCursor_ObjCProtocolRef); + return std::make_pair(static_cast<ObjCProtocolDecl *>(C.data[0]), + SourceLocation::getFromRawEncoding( + reinterpret_cast<uintptr_t>(C.data[1]))); +} + Decl *cxcursor::getCursorDecl(CXCursor Cursor) { return (Decl *)Cursor.data[0]; } @@ -99,7 +114,8 @@ Expr *cxcursor::getCursorExpr(CXCursor Cursor) { } Stmt *cxcursor::getCursorStmt(CXCursor Cursor) { - if (Cursor.kind == CXCursor_ObjCSuperClassRef) + if (Cursor.kind == CXCursor_ObjCSuperClassRef || + Cursor.kind == CXCursor_ObjCProtocolRef) return 0; return (Stmt *)Cursor.data[1]; |