diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-03-18 15:23:44 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-03-18 15:23:44 +0000 |
commit | 4807231938d8aff28de09f78f301f9ba5845e5e4 (patch) | |
tree | 6d93685e685370be3a6b5d86085f6118d1e4a71b /tools/CIndex/CXCursor.cpp | |
parent | a49f1afdfa19630c4a76caa4e6ad548ee8f79fd1 (diff) |
More token-annotation experimentation, preprocessing the annotated
token sequence to detect macro instantiations (that produce at least
token). WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98826 91177308-0d34-0410-b5e6-96231b3b80d8
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]; } |