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 | 02ded2a56c823990411a1179b042861d1c77a141 (patch) | |
tree | 04894f162cac018e0e0488bd02595a4879306da7 /clang/tools/CIndex/CXCursor.cpp | |
parent | 48d75d1bda316afd66b73cd8046c52635f0772a7 (diff) | |
download | bcm5719-llvm-02ded2a56c823990411a1179b042861d1c77a141.tar.gz bcm5719-llvm-02ded2a56c823990411a1179b042861d1c77a141.zip |
More token-annotation experimentation, preprocessing the annotated
token sequence to detect macro instantiations (that produce at least
token). WIP.
llvm-svn: 98826
Diffstat (limited to 'clang/tools/CIndex/CXCursor.cpp')
-rw-r--r-- | clang/tools/CIndex/CXCursor.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/tools/CIndex/CXCursor.cpp b/clang/tools/CIndex/CXCursor.cpp index f2294b0996f..aa81d60f61d 100644 --- a/clang/tools/CIndex/CXCursor.cpp +++ b/clang/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]; } |