diff options
Diffstat (limited to 'tools/CIndex/CXCursor.cpp')
-rw-r--r-- | tools/CIndex/CXCursor.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/CIndex/CXCursor.cpp b/tools/CIndex/CXCursor.cpp index f2294b0996..aa81d60f61 100644 --- a/tools/CIndex/CXCursor.cpp +++ b/tools/CIndex/CXCursor.cpp @@ -314,6 +314,24 @@ SourceRange cxcursor::getCursorPreprocessingDirective(CXCursor C) { reinterpret_cast<uintptr_t> (C.data[1]))); } +CXCursor cxcursor::MakeMacroInstantiationCursor(SourceRange Range, + ASTUnit *TU) { + CXCursor C = { CXCursor_MacroInstantiation, + { reinterpret_cast<void *>(Range.getBegin().getRawEncoding()), + reinterpret_cast<void *>(Range.getEnd().getRawEncoding()), + TU } + }; + return C; +} + +SourceRange cxcursor::getCursorMacroInstantiation(CXCursor C) { + assert(C.kind == CXCursor_MacroInstantiation); + return SourceRange(SourceLocation::getFromRawEncoding( + reinterpret_cast<uintptr_t> (C.data[0])), + SourceLocation::getFromRawEncoding( + reinterpret_cast<uintptr_t> (C.data[1]))); +} + Decl *cxcursor::getCursorDecl(CXCursor Cursor) { return (Decl *)Cursor.data[0]; } |