diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-21 16:28:34 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-21 16:28:34 +0000 |
commit | 7d0d40e58807f73e06ff5eb637a48e9f978b0e2a (patch) | |
tree | 915bf1da7b2af745ef8180943559dcdd184759dc /tools/CIndex/CXCursor.cpp | |
parent | c0265406a82d391a5fc60d16dd1c6cd61a92cfce (diff) |
Introduce type references into the C API, capturing references to
typedefs only (for now).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94078 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/CIndex/CXCursor.cpp')
-rw-r--r-- | tools/CIndex/CXCursor.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/CIndex/CXCursor.cpp b/tools/CIndex/CXCursor.cpp index 29bd4e2bbc..63d9bc9f2e 100644 --- a/tools/CIndex/CXCursor.cpp +++ b/tools/CIndex/CXCursor.cpp @@ -259,6 +259,21 @@ cxcursor::getCursorObjCClassRef(CXCursor C) { reinterpret_cast<uintptr_t>(C.data[1]))); } +CXCursor cxcursor::MakeCursorTypeRef(TypeDecl *Type, SourceLocation Loc, + ASTUnit *TU) { + void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding()); + CXCursor C = { CXCursor_TypeRef, { Type, RawLoc, TU } }; + return C; +} + +std::pair<TypeDecl *, SourceLocation> +cxcursor::getCursorTypeRef(CXCursor C) { + assert(C.kind == CXCursor_TypeRef); + return std::make_pair(static_cast<TypeDecl *>(C.data[0]), + SourceLocation::getFromRawEncoding( + reinterpret_cast<uintptr_t>(C.data[1]))); +} + Decl *cxcursor::getCursorDecl(CXCursor Cursor) { return (Decl *)Cursor.data[0]; } |