diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-03-18 00:42:48 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-03-18 00:42:48 +0000 |
commit | 92a524fd47b3e3ee9dcbfca86721eeb7c1672f9f (patch) | |
tree | f5d8b2eb840132b9c4999e23821e06f9d1153867 /clang/tools/CIndex/CXCursor.cpp | |
parent | 8575110ae188294adaf2ac766cd5427fb99c5e8a (diff) | |
download | bcm5719-llvm-92a524fd47b3e3ee9dcbfca86721eeb7c1672f9f.tar.gz bcm5719-llvm-92a524fd47b3e3ee9dcbfca86721eeb7c1672f9f.zip |
Experimental stab at using relexing to identify preprocessor
directives while annotating tokens in CIndex. This functionality
should probably be factored out of this routine, but we're not there
yet.
llvm-svn: 98786
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 0fa73a513da..f2294b0996f 100644 --- a/clang/tools/CIndex/CXCursor.cpp +++ b/clang/tools/CIndex/CXCursor.cpp @@ -296,6 +296,24 @@ cxcursor::getCursorTypeRef(CXCursor C) { reinterpret_cast<uintptr_t>(C.data[1]))); } +CXCursor cxcursor::MakePreprocessingDirectiveCursor(SourceRange Range, + ASTUnit *TU) { + CXCursor C = { CXCursor_PreprocessingDirective, + { reinterpret_cast<void *>(Range.getBegin().getRawEncoding()), + reinterpret_cast<void *>(Range.getEnd().getRawEncoding()), + TU } + }; + return C; +} + +SourceRange cxcursor::getCursorPreprocessingDirective(CXCursor C) { + assert(C.kind == CXCursor_PreprocessingDirective); + 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]; } |