diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-16 14:00:32 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-16 14:00:32 +0000 |
commit | 6c8959b71b10c9369fa13997bbc6d0772009f9a0 (patch) | |
tree | 1da22d9c8eeff8260fd3984e23f1b1b1201e9ac1 /clang/tools/CIndex/CXCursor.cpp | |
parent | b478d3e0fc818747b735e587b0cd55f84c431072 (diff) | |
download | bcm5719-llvm-6c8959b71b10c9369fa13997bbc6d0772009f9a0.tar.gz bcm5719-llvm-6c8959b71b10c9369fa13997bbc6d0772009f9a0.zip |
Give CXCursor_ObjCSuperClassRef a sane encoding, which is only known
to CXCursor.cpp.
llvm-svn: 93634
Diffstat (limited to 'clang/tools/CIndex/CXCursor.cpp')
-rw-r--r-- | clang/tools/CIndex/CXCursor.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/clang/tools/CIndex/CXCursor.cpp b/clang/tools/CIndex/CXCursor.cpp index a8f3eb1d3db..d6c38673e01 100644 --- a/clang/tools/CIndex/CXCursor.cpp +++ b/clang/tools/CIndex/CXCursor.cpp @@ -7,7 +7,9 @@ // //===----------------------------------------------------------------------===// // -// This file defines routines for manipulating CXCursors. +// This file defines routines for manipulating CXCursors. It should be the +// only file that has internal knowledge of the encoding of the data in +// CXCursor. // //===----------------------------------------------------------------------===// @@ -73,6 +75,21 @@ CXCursor cxcursor::MakeCXCursor(Decl *D) { return MakeCXCursor(GetCursorKind(D), D); } +CXCursor cxcursor::MakeCursorObjCSuperClassRef(ObjCInterfaceDecl *Super, + SourceLocation Loc) { + void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding()); + CXCursor C = { CXCursor_ObjCSuperClassRef, { Super, RawLoc, 0 } }; + return C; +} + +std::pair<ObjCInterfaceDecl *, SourceLocation> +cxcursor::getCursorObjCSuperClassRef(CXCursor C) { + assert(C.kind == CXCursor_ObjCSuperClassRef); + return std::make_pair(static_cast<ObjCInterfaceDecl *>(C.data[0]), + SourceLocation::getFromRawEncoding( + reinterpret_cast<uintptr_t>(C.data[1]))); +} + Decl *cxcursor::getCursorDecl(CXCursor Cursor) { return (Decl *)Cursor.data[0]; } @@ -82,6 +99,9 @@ Expr *cxcursor::getCursorExpr(CXCursor Cursor) { } Stmt *cxcursor::getCursorStmt(CXCursor Cursor) { + if (Cursor.kind == CXCursor_ObjCSuperClassRef) + return 0; + return (Stmt *)Cursor.data[1]; } @@ -99,4 +119,4 @@ NamedDecl *cxcursor::getCursorInterfaceParent(CXCursor Cursor) { bool cxcursor::operator==(CXCursor X, CXCursor Y) { return X.kind == Y.kind && X.data[0] == Y.data[0] && X.data[1] == Y.data[1] && X.data[2] == Y.data[2]; -}
\ No newline at end of file +} |